aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/genrev/CMakeLists.txt2
-rw-r--r--src/server/authserver/Realms/RealmList.cpp42
-rw-r--r--src/server/authserver/Realms/RealmList.h6
-rw-r--r--src/server/authserver/Server/AuthSocket.cpp32
-rw-r--r--src/server/authserver/Server/AuthSocket.h5
-rw-r--r--src/server/authserver/Server/RealmSocket.cpp8
-rw-r--r--src/server/collision/BoundingIntervalHierarchy.cpp12
-rw-r--r--src/server/collision/BoundingIntervalHierarchy.h33
-rw-r--r--src/server/collision/BoundingIntervalHierarchyWrapper.h8
-rw-r--r--src/server/collision/DynamicTree.cpp61
-rw-r--r--src/server/collision/DynamicTree.h26
-rw-r--r--src/server/collision/Maps/MapTree.h2
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp3
-rw-r--r--src/server/collision/Models/WorldModel.h28
-rw-r--r--src/server/collision/RegularGrid.h16
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.cpp12
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.h12
-rw-r--r--src/server/game/AI/CoreAI/GameObjectAI.h2
-rw-r--r--src/server/game/AI/CoreAI/PassiveAI.cpp4
-rw-r--r--src/server/game/AI/CoreAI/PassiveAI.h6
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp2
-rw-r--r--src/server/game/AI/CoreAI/PetAI.h2
-rw-r--r--src/server/game/AI/CoreAI/ReactorAI.cpp23
-rw-r--r--src/server/game/AI/CoreAI/ReactorAI.h4
-rw-r--r--src/server/game/AI/CoreAI/TotemAI.cpp2
-rw-r--r--src/server/game/AI/CoreAI/TotemAI.h2
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.cpp11
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h6
-rw-r--r--src/server/game/AI/CreatureAIImpl.h330
-rw-r--r--src/server/game/AI/CreatureAISelector.cpp6
-rw-r--r--src/server/game/AI/EventAI/CreatureEventAI.cpp2
-rw-r--r--src/server/game/AI/EventAI/CreatureEventAI.h2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp29
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h28
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp4
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp4
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h4
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp21
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp112
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h18
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp256
-rw-r--r--src/server/game/Accounts/AccountMgr.h31
-rw-r--r--src/server/game/Accounts/RBAC.cpp341
-rw-r--r--src/server/game/Accounts/RBAC.h447
-rw-r--r--src/server/game/Achievements/AchievementMgr.cpp11
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp47
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp13
-rw-r--r--src/server/game/Battlefield/Battlefield.h2
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp25
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp87
-rw-r--r--src/server/game/Calendar/CalendarMgr.h16
-rw-r--r--src/server/game/Chat/Channels/Channel.cpp52
-rw-r--r--src/server/game/Chat/Channels/Channel.h4
-rw-r--r--src/server/game/Chat/Chat.cpp31
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp3
-rw-r--r--src/server/game/DungeonFinding/LFG.cpp108
-rw-r--r--src/server/game/DungeonFinding/LFG.h9
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.cpp5
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.h5
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp174
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h173
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.cpp5
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.h5
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.cpp11
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.h5
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp37
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.h6
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp39
-rw-r--r--src/server/game/Entities/Creature/Creature.h19
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp35
-rw-r--r--src/server/game/Entities/Creature/GossipDef.h2
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.h16
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp4
-rw-r--r--src/server/game/Entities/Item/ItemEnchantmentMgr.cpp2
-rw-r--r--src/server/game/Entities/Object/Object.cpp114
-rw-r--r--src/server/game/Entities/Object/Object.h5
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateMask.h116
-rw-r--r--src/server/game/Entities/Player/Player.cpp109
-rw-r--r--src/server/game/Entities/Player/Player.h8
-rw-r--r--src/server/game/Entities/Player/SocialMgr.cpp71
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp6
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp7
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp145
-rw-r--r--src/server/game/Entities/Unit/Unit.h3
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp586
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.h59
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h2
-rw-r--r--src/server/game/Events/GameEventMgr.cpp37
-rw-r--r--src/server/game/Events/GameEventMgr.h4
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp253
-rw-r--r--src/server/game/Globals/ObjectMgr.h44
-rw-r--r--src/server/game/Groups/Group.cpp4
-rw-r--r--src/server/game/Guilds/Guild.cpp21
-rw-r--r--src/server/game/Handlers/AddonHandler.cpp28
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp4
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp8
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp120
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp24
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp125
-rw-r--r--src/server/game/Handlers/LootHandler.cpp4
-rw-r--r--src/server/game/Handlers/MailHandler.cpp147
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp85
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp2
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp26
-rw-r--r--src/server/game/Loot/LootMgr.cpp460
-rw-r--r--src/server/game/Loot/LootMgr.h17
-rw-r--r--src/server/game/Maps/Map.cpp50
-rw-r--r--src/server/game/Maps/Map.h18
-rw-r--r--src/server/game/Maps/MapManager.cpp9
-rw-r--r--src/server/game/Miscellaneous/Formulas.h7
-rw-r--r--src/server/game/Miscellaneous/Language.h43
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h235
-rw-r--r--src/server/game/Movement/MotionMaster.cpp7
-rw-r--r--src/server/game/Movement/MotionMaster.h2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp9
-rw-r--r--src/server/game/Movement/PathGenerator.h4
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp2
-rw-r--r--src/server/game/Movement/Spline/MovementPacketBuilder.cpp3
-rw-r--r--src/server/game/Movement/Spline/MovementPacketBuilder.h1
-rw-r--r--src/server/game/Movement/Waypoints/WaypointManager.cpp4
-rw-r--r--src/server/game/Scripting/ScriptLoader.cpp6
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp6
-rw-r--r--src/server/game/Scripting/ScriptMgr.h3
-rw-r--r--src/server/game/Server/Protocol/PacketLog.cpp2
-rw-r--r--src/server/game/Server/WorldSession.cpp71
-rw-r--r--src/server/game/Server/WorldSession.h37
-rw-r--r--src/server/game/Server/WorldSocket.cpp38
-rw-r--r--src/server/game/Skills/SkillDiscovery.cpp4
-rw-r--r--src/server/game/Skills/SkillExtraItems.cpp12
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp61
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp166
-rw-r--r--src/server/game/Spells/Spell.cpp42
-rw-r--r--src/server/game/Spells/SpellEffects.cpp29
-rw-r--r--src/server/game/Spells/SpellInfo.cpp11
-rw-r--r--src/server/game/Spells/SpellInfo.h1
-rw-r--r--src/server/game/Spells/SpellMgr.cpp19
-rw-r--r--src/server/game/Spells/SpellScript.cpp2
-rw-r--r--src/server/game/Warden/Warden.cpp2
-rw-r--r--src/server/game/Warden/WardenCheckMgr.cpp14
-rw-r--r--src/server/game/Warden/WardenMac.cpp2
-rw-r--r--src/server/game/Warden/WardenWin.cpp2
-rw-r--r--src/server/game/Weather/Weather.cpp3
-rw-r--r--src/server/game/Weather/Weather.h1
-rw-r--r--src/server/game/Weather/WeatherMgr.cpp4
-rw-r--r--src/server/game/World/World.cpp71
-rw-r--r--src/server/game/World/World.h6
-rw-r--r--src/server/scripts/Commands/CMakeLists.txt1
-rw-r--r--src/server/scripts/Commands/cs_account.cpp34
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp46
-rw-r--r--src/server/scripts/Commands/cs_lfg.cpp10
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp120
-rw-r--r--src/server/scripts/Commands/cs_mmaps.cpp2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp9
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp3
-rw-r--r--src/server/scripts/Commands/cs_rbac.cpp780
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp7
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp93
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp22
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp87
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp49
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp22
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/boss_kruul.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_duskwood.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp9
-rw-r--r--src/server/scripts/Events/childrens_week.cpp14
-rw-r--r--src/server/scripts/Examples/example_creature.cpp2
-rw-r--r--src/server/scripts/Examples/example_escort.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp2
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CMakeLists.txt6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp31
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp (renamed from src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp)2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp (renamed from src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp)2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp (renamed from src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp)2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp4
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp2
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp2
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp2
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp2
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp9
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp4
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp15
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp46
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp6
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp4
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp2
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp2
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp8
-rw-r--r--src/server/scripts/Kalimdor/boss_azuregos.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_ashenvale.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_azshara.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp12
-rw-r--r--src/server/scripts/Kalimdor/zone_darkshore.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_desolace.cpp110
-rw-r--r--src/server/scripts/Kalimdor/zone_durotar.cpp11
-rw-r--r--src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp8
-rw-r--r--src/server/scripts/Kalimdor/zone_moonglade.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_mulgore.cpp4
-rw-r--r--src/server/scripts/Kalimdor/zone_orgrimmar.cpp4
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp4
-rw-r--r--src/server/scripts/Kalimdor/zone_thousand_needles.cpp4
-rw-r--r--src/server/scripts/Kalimdor/zone_thunder_bluff.cpp5
-rw-r--r--src/server/scripts/Kalimdor/zone_ungoro_crater.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp8
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp10
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp14
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp10
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp2
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp14
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp2
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp33
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp17
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp2
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp71
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp2
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp8
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp6
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp12
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp20
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp34
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp80
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp23
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp16
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp10
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp8
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp6
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp2
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp8
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp14
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp24
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp6
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp18
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp6
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp11
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_eck.cpp2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp2
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp6
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp26
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp59
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp26
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp4
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp21
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp248
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp19
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp10
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp115
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp69
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp26
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp33
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h1
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp10
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_noth.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp8
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp12
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp9
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_commander_kolurg.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp6
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp7
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp25
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp12
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp10
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp26
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp66
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp18
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp30
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp19
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp8
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp12
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp2
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp12
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp2
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp4
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp4
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp4
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp14
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp4
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp6
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_moragg.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp4
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp24
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp38
-rw-r--r--src/server/scripts/Northrend/zone_crystalsong_forest.cpp9
-rw-r--r--src/server/scripts/Northrend/zone_dalaran.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp14
-rw-r--r--src/server/scripts/Northrend/zone_icecrown.cpp26
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp8
-rw-r--r--src/server/scripts/Northrend/zone_storm_peaks.cpp124
-rw-r--r--src/server/scripts/Northrend/zone_wintergrasp.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_zuldrak.cpp18
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp6
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp6
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp10
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp12
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp19
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_supremus.cpp13
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp9
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp12
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp70
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp5
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp10
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp16
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp17
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp11
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp2
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_gruul.cpp2
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp13
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp8
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp6
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp14
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp25
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp4
-rw-r--r--src/server/scripts/Outland/boss_doomlord_kazzak.cpp2
-rw-r--r--src/server/scripts/Outland/boss_doomwalker.cpp2
-rw-r--r--src/server/scripts/Outland/zone_blades_edge_mountains.cpp12
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp4
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp6
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp8
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp93
-rw-r--r--src/server/scripts/Outland/zone_shattrath_city.cpp6
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp6
-rw-r--r--src/server/scripts/Outland/zone_zangarmarsh.cpp2
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp121
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp2
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp8
-rw-r--r--src/server/scripts/Spells/spell_item.cpp63
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp12
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp6
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp8
-rw-r--r--src/server/scripts/World/achievement_scripts.cpp25
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp64
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp16
-rw-r--r--src/server/scripts/World/guards.cpp6
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp4
-rw-r--r--src/server/scripts/World/npcs_special.cpp43
-rw-r--r--src/server/shared/Common.h2
-rw-r--r--src/server/shared/Database/DatabaseWorkerPool.h3
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp4
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h2
-rw-r--r--src/server/shared/Database/Implementation/LoginDatabase.cpp29
-rw-r--r--src/server/shared/Database/Implementation/LoginDatabase.h11
-rw-r--r--src/server/shared/Database/Implementation/WorldDatabase.cpp2
-rw-r--r--src/server/shared/Database/MySQLConnection.cpp5
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp187
-rw-r--r--src/server/shared/Logging/AppenderFile.cpp3
-rw-r--r--src/server/shared/Logging/Log.cpp3
-rw-r--r--src/server/shared/Packets/ByteBuffer.h2
-rw-r--r--src/server/shared/Utilities/Util.cpp16
-rw-r--r--src/server/shared/Utilities/Util.h8
-rw-r--r--src/server/worldserver/RemoteAccess/RASocket.cpp45
-rw-r--r--src/server/worldserver/RemoteAccess/RASocket.h1
-rw-r--r--src/server/worldserver/TCSoap/TCSoap.cpp15
-rw-r--r--src/server/worldserver/TCSoap/TCSoap.h10
-rw-r--r--src/server/worldserver/worldserver.conf.dist40
-rw-r--r--src/tools/CMakeLists.txt4
-rw-r--r--src/tools/mmaps_generator/MapBuilder.cpp2
-rw-r--r--src/tools/mmaps_generator/TerrainBuilder.cpp24
-rw-r--r--src/tools/mmaps_generator/VMapExtensions.cpp4
623 files changed, 7796 insertions, 4458 deletions
diff --git a/src/genrev/CMakeLists.txt b/src/genrev/CMakeLists.txt
index c01c57b636f..b54534af827 100644
--- a/src/genrev/CMakeLists.txt
+++ b/src/genrev/CMakeLists.txt
@@ -10,6 +10,6 @@
# Need to pass old ${CMAKE_BINARY_DIR} as param because its different at build stage
add_custom_target(revision.h ALL
- COMMAND ${CMAKE_COMMAND} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/genrev.cmake
+ COMMAND ${CMAKE_COMMAND} -DNO_GIT=${WITHOUT_GIT} -DGIT_EXEC=${GIT_EXECUTABLE} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/genrev.cmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp
index 72873e40ce5..b4becc96451 100644
--- a/src/server/authserver/Realms/RealmList.cpp
+++ b/src/server/authserver/Realms/RealmList.cpp
@@ -31,12 +31,12 @@ void RealmList::Initialize(uint32 updateInterval)
UpdateRealms(true);
}
-void RealmList::UpdateRealm(uint32 ID, const std::string& name, ACE_INET_Addr const& address, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
+void RealmList::UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build)
{
// Create new if not exist or update existed
Realm& realm = m_realms[name];
- realm.m_ID = ID;
+ realm.m_ID = id;
realm.name = name;
realm.icon = icon;
realm.flag = flag;
@@ -45,7 +45,9 @@ void RealmList::UpdateRealm(uint32 ID, const std::string& name, ACE_INET_Addr co
realm.populationLevel = popu;
// Append port to IP address.
- address.addr_to_string(realm.address, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16);
+ realm.ExternalAddress = address;
+ realm.LocalAddress = localAddr;
+ realm.LocalSubnetMask = localSubmask;
realm.gamebuild = build;
}
@@ -77,23 +79,27 @@ void RealmList::UpdateRealms(bool init)
do
{
Field* fields = result->Fetch();
- uint32 realmId = fields[0].GetUInt32();
- std::string name = fields[1].GetString();
- std::string address = fields[2].GetString();
- uint16 port = fields[3].GetUInt16();
- uint8 icon = fields[4].GetUInt8();
- RealmFlags flag = RealmFlags(fields[5].GetUInt8());
- uint8 timezone = fields[6].GetUInt8();
- uint8 allowedSecurityLevel = fields[7].GetUInt8();
- float pop = fields[8].GetFloat();
- uint32 build = fields[9].GetUInt32();
-
- ACE_INET_Addr addr(port, address.c_str(), AF_INET);
-
- UpdateRealm(realmId, name, addr, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build);
+ uint32 realmId = fields[0].GetUInt32();
+ std::string name = fields[1].GetString();
+ std::string externalAddress = fields[2].GetString();
+ std::string localAddress = fields[3].GetString();
+ std::string localSubmask = fields[4].GetString();
+ uint16 port = fields[5].GetUInt16();
+ uint8 icon = fields[6].GetUInt8();
+ RealmFlags flag = RealmFlags(fields[7].GetUInt8());
+ uint8 timezone = fields[8].GetUInt8();
+ uint8 allowedSecurityLevel = fields[9].GetUInt8();
+ float pop = fields[10].GetFloat();
+ uint32 build = fields[11].GetUInt32();
+
+ ACE_INET_Addr externalAddr(port, externalAddress.c_str(), AF_INET);
+ ACE_INET_Addr localAddr(port, localAddress.c_str(), AF_INET);
+ ACE_INET_Addr submask(0, localSubmask.c_str(), AF_INET);
+
+ UpdateRealm(realmId, name, externalAddr, localAddr, submask, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build);
if (init)
- sLog->outInfo(LOG_FILTER_AUTHSERVER, "Added realm \"%s\" at %s.", name.c_str(), m_realms[name].address);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port);
}
while (result->NextRow());
}
diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h
index 1949c34df9a..68e6524c334 100644
--- a/src/server/authserver/Realms/RealmList.h
+++ b/src/server/authserver/Realms/RealmList.h
@@ -40,7 +40,9 @@ enum RealmFlags
// Storage object for a realm
struct Realm
{
- char address[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
+ ACE_INET_Addr ExternalAddress;
+ ACE_INET_Addr LocalAddress;
+ ACE_INET_Addr LocalSubnetMask;
std::string name;
uint8 icon;
RealmFlags flag;
@@ -72,7 +74,7 @@ public:
private:
void UpdateRealms(bool init=false);
- void UpdateRealm(uint32 ID, const std::string& name, ACE_INET_Addr const& address, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
+ void UpdateRealm(uint32 id, const std::string& name, ACE_INET_Addr const& address, ACE_INET_Addr const& localAddr, ACE_INET_Addr const& localSubmask, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build);
RealmMap m_realms;
uint32 m_UpdateInterval;
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 8ab4ab8a1a2..32ddf029f1c 100644
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -207,7 +207,7 @@ AuthSocket::AuthSocket(RealmSocket& socket) : pPatch(NULL), socket_(socket)
// Close patch file descriptor before leaving
AuthSocket::~AuthSocket(void) {}
-// Accept the connection and set the s random value for SRP6
+// Accept the connection
void AuthSocket::OnAccept(void)
{
sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
@@ -818,6 +818,28 @@ bool AuthSocket::_HandleReconnectProof()
}
}
+ACE_INET_Addr const& AuthSocket::GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr)
+{
+ // Attempt to send best address for client
+ if (clientAddr.is_loopback())
+ {
+ // Try guessing if realm is also connected locally
+ if (realm.LocalAddress.is_loopback() || realm.ExternalAddress.is_loopback())
+ return clientAddr;
+
+ // Assume that user connecting from the machine that authserver is located on
+ // has all realms available in his local network
+ return realm.LocalAddress;
+ }
+
+ // Check if connecting client is in the same network
+ if (IsIPAddrInNetwork(realm.LocalAddress, clientAddr, realm.LocalSubnetMask))
+ return realm.LocalAddress;
+
+ // Return external IP
+ return realm.ExternalAddress;
+}
+
// Realm List command handler
bool AuthSocket::_HandleRealmList()
{
@@ -845,6 +867,9 @@ bool AuthSocket::_HandleRealmList()
// Update realm list if need
sRealmList->UpdateIfNeed();
+ ACE_INET_Addr clientAddr;
+ socket().peer().get_remote_addr(clientAddr);
+
// Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm)
ByteBuffer pkt;
@@ -876,6 +901,9 @@ bool AuthSocket::_HandleRealmList()
name = ss.str();
}
+ // We don't need the port number from which client connects with but the realm's port
+ clientAddr.set_port_number(i->second.ExternalAddress.get_port_number());
+
uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
uint8 AmountOfCharacters = 0;
@@ -891,7 +919,7 @@ bool AuthSocket::_HandleRealmList()
pkt << lock; // if 1, then realm locked
pkt << uint8(flag); // RealmFlags
pkt << name;
- pkt << i->second.address;
+ pkt << GetAddressString(GetAddressForClient(i->second, clientAddr));
pkt << i->second.populationLevel;
pkt << AmountOfCharacters;
pkt << i->second.timezone; // realm category
diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h
index 87fd092381e..6c13f85a022 100644
--- a/src/server/authserver/Server/AuthSocket.h
+++ b/src/server/authserver/Server/AuthSocket.h
@@ -23,6 +23,9 @@
#include "BigNumber.h"
#include "RealmSocket.h"
+class ACE_INET_Addr;
+struct Realm;
+
// Handle login commands
class AuthSocket: public RealmSocket::Session
{
@@ -36,6 +39,8 @@ public:
virtual void OnAccept(void);
virtual void OnClose(void);
+ static ACE_INET_Addr const& GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr);
+
bool _HandleLogonChallenge();
bool _HandleLogonProof();
bool _HandleReconnectChallenge();
diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp
index e67af783d5f..565a8c9a600 100644
--- a/src/server/authserver/Server/RealmSocket.cpp
+++ b/src/server/authserver/Server/RealmSocket.cpp
@@ -23,10 +23,6 @@
#include "RealmSocket.h"
#include "Log.h"
-#ifndef MSG_NOSIGNAL
-#define MSG_NOSIGNAL 0
-#endif
-
RealmSocket::Session::Session(void) {}
RealmSocket::Session::~Session(void) { }
@@ -138,7 +134,11 @@ ssize_t RealmSocket::noblk_send(ACE_Message_Block &message_block)
return -1;
// Try to send the message directly.
+#ifdef MSG_NOSIGNAL
ssize_t n = peer().send(message_block.rd_ptr(), len, MSG_NOSIGNAL);
+#else
+ ssize_t n = peer().send(message_block.rd_ptr(), len);
+#endif // MSG_NOSIGNAL
if (n < 0)
{
diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp
index ad3753ea3c9..bca738d1ff6 100644
--- a/src/server/collision/BoundingIntervalHierarchy.cpp
+++ b/src/server/collision/BoundingIntervalHierarchy.cpp
@@ -18,6 +18,12 @@
#include "BoundingIntervalHierarchy.h"
+#if defined __APPLE__
+ #define isnan std::isnan
+#elif defined _MSC_VER
+ #define isnan _isnan
+#endif
+
void BIH::buildHierarchy(std::vector<uint32> &tempTree, buildData &dat, BuildStats &stats)
{
// create space for the first node
@@ -51,7 +57,7 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
prevAxis = axis;
prevSplit = split;
// perform quick consistency checks
- Vector3 d( gridBox.hi - gridBox.lo );
+ G3D::Vector3 d( gridBox.hi - gridBox.lo );
if (d.x < 0 || d.y < 0 || d.z < 0)
throw std::logic_error("negative node extents");
for (int i = 0; i < 3; i++)
@@ -255,11 +261,11 @@ bool BIH::writeToFile(FILE* wf) const
bool BIH::readFromFile(FILE* rf)
{
uint32 treeSize;
- Vector3 lo, hi;
+ G3D::Vector3 lo, hi;
uint32 check=0, count=0;
check += fread(&lo, sizeof(float), 3, rf);
check += fread(&hi, sizeof(float), 3, rf);
- bounds = AABox(lo, hi);
+ bounds = G3D::AABox(lo, hi);
check += fread(&treeSize, sizeof(uint32), 1, rf);
tree.resize(treeSize);
check += fread(&tree[0], sizeof(uint32), treeSize, rf);
diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h
index 7cbaedbfba6..997f9c99e5f 100644
--- a/src/server/collision/BoundingIntervalHierarchy.h
+++ b/src/server/collision/BoundingIntervalHierarchy.h
@@ -31,20 +31,8 @@
#include <limits>
#include <cmath>
-#ifdef __APPLE__
- #define isnan(x) ( std::isnan(x) )
-#endif
-
#define MAX_STACK_SIZE 64
-#ifdef _MSC_VER
- #define isnan(x) _isnan(x)
-#endif
-
-using G3D::Vector3;
-using G3D::AABox;
-using G3D::Ray;
-
static inline uint32 floatToRawIntBits(float f)
{
union
@@ -69,7 +57,7 @@ static inline float intBitsToFloat(uint32 i)
struct AABound
{
- Vector3 lo, hi;
+ G3D::Vector3 lo, hi;
};
/** Bounding Interval Hierarchy Class.
@@ -105,12 +93,11 @@ class BIH
dat.maxPrims = leafSize;
dat.numPrims = primitives.size();
dat.indices = new uint32[dat.numPrims];
- dat.primBound = new AABox[dat.numPrims];
+ dat.primBound = new G3D::AABox[dat.numPrims];
getBounds(primitives[0], bounds);
for (uint32 i=0; i<dat.numPrims; ++i)
{
dat.indices[i] = i;
- AABox tb;
getBounds(primitives[i], dat.primBound[i]);
bounds.merge(dat.primBound[i]);
}
@@ -131,13 +118,13 @@ class BIH
uint32 primCount() const { return objects.size(); }
template<typename RayCallback>
- void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const
+ void intersectRay(const G3D::Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const
{
float intervalMin = -1.f;
float intervalMax = -1.f;
- Vector3 org = r.origin();
- Vector3 dir = r.direction();
- Vector3 invDir;
+ G3D::Vector3 org = r.origin();
+ G3D::Vector3 dir = r.direction();
+ G3D::Vector3 invDir;
for (int i=0; i<3; ++i)
{
invDir[i] = 1.f / dir[i];
@@ -270,7 +257,7 @@ class BIH
}
template<typename IsectCallback>
- void intersectPoint(const Vector3 &p, IsectCallback& intersectCallback) const
+ void intersectPoint(const G3D::Vector3 &p, IsectCallback& intersectCallback) const
{
if (!bounds.contains(p))
return;
@@ -353,12 +340,12 @@ class BIH
protected:
std::vector<uint32> tree;
std::vector<uint32> objects;
- AABox bounds;
+ G3D::AABox bounds;
struct buildData
{
uint32 *indices;
- AABox *primBound;
+ G3D::AABox *primBound;
uint32 numPrims;
int maxPrims;
};
@@ -410,4 +397,4 @@ class BIH
void subdivide(int left, int right, std::vector<uint32> &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats);
};
-#endif // _BIH_H \ No newline at end of file
+#endif // _BIH_H
diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h
index 315f3004306..305d57b0075 100644
--- a/src/server/collision/BoundingIntervalHierarchyWrapper.h
+++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h
@@ -37,7 +37,7 @@ class BIHWrap
MDLCallback(RayCallback& callback, const T* const* objects_array, uint32 objects_size ) : objects(objects_array), _callback(callback), objects_size(objects_size) {}
- bool operator() (const Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/)
+ bool operator() (const G3D::Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/)
{
if (Idx >= objects_size)
return false;
@@ -46,7 +46,7 @@ class BIHWrap
return false;
}
- void operator() (const Vector3& p, uint32 Idx)
+ void operator() (const G3D::Vector3& p, uint32 Idx)
{
if (Idx >= objects_size)
return false;
@@ -98,7 +98,7 @@ public:
}
template<typename RayCallback>
- void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& maxDist)
+ void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& maxDist)
{
balance();
MDLCallback<RayCallback> temp_cb(intersectCallback, m_objects.getCArray(), m_objects.size());
@@ -106,7 +106,7 @@ public:
}
template<typename IsectCallback>
- void intersectPoint(const Vector3& point, IsectCallback& intersectCallback)
+ void intersectPoint(const G3D::Vector3& point, IsectCallback& intersectCallback)
{
balance();
MDLCallback<IsectCallback> callback(intersectCallback, m_objects.getCArray(), m_objects.size());
diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp
index c6754278d17..c70a4b78a03 100644
--- a/src/server/collision/DynamicTree.cpp
+++ b/src/server/collision/DynamicTree.cpp
@@ -27,15 +27,24 @@
#include "GameObjectModel.h"
#include "ModelInstance.h"
+#include <G3D/AABox.h>
+#include <G3D/Ray.h>
+#include <G3D/Vector3.h>
+
using VMAP::ModelInstance;
-using G3D::Ray;
+
+namespace {
+
+int CHECK_TREE_PERIOD = 200;
+
+} // namespace
template<> struct HashTrait< GameObjectModel>{
static size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; }
};
template<> struct PositionTrait< GameObjectModel> {
- static void getPosition(const GameObjectModel& g, Vector3& p) { p = g.getPosition(); }
+ static void getPosition(const GameObjectModel& g, G3D::Vector3& p) { p = g.getPosition(); }
};
template<> struct BoundsTrait< GameObjectModel> {
@@ -49,11 +58,6 @@ static bool operator == (const GameObjectModel& mdl, const GameObjectModel& mdl2
}
*/
-int valuesPerNode = 5, numMeanSplits = 3;
-
-int UNBALANCED_TIMES_LIMIT = 5;
-int CHECK_TREE_PERIOD = 200;
-
typedef RegularGrid2D<GameObjectModel, BIHWrap<GameObjectModel> > ParentTree;
struct DynTreeImpl : public ParentTree/*, public Intersectable*/
@@ -103,43 +107,43 @@ struct DynTreeImpl : public ParentTree/*, public Intersectable*/
int unbalanced_times;
};
-DynamicMapTree::DynamicMapTree() : impl(*new DynTreeImpl())
+DynamicMapTree::DynamicMapTree() : impl(new DynTreeImpl())
{
}
DynamicMapTree::~DynamicMapTree()
{
- delete &impl;
+ delete impl;
}
void DynamicMapTree::insert(const GameObjectModel& mdl)
{
- impl.insert(mdl);
+ impl->insert(mdl);
}
void DynamicMapTree::remove(const GameObjectModel& mdl)
{
- impl.remove(mdl);
+ impl->remove(mdl);
}
bool DynamicMapTree::contains(const GameObjectModel& mdl) const
{
- return impl.contains(mdl);
+ return impl->contains(mdl);
}
void DynamicMapTree::balance()
{
- impl.balance();
+ impl->balance();
}
int DynamicMapTree::size() const
{
- return impl.size();
+ return impl->size();
}
void DynamicMapTree::update(uint32 t_diff)
{
- impl.update(t_diff);
+ impl->update(t_diff);
}
struct DynamicTreeIntersectionCallback
@@ -147,7 +151,7 @@ struct DynamicTreeIntersectionCallback
bool did_hit;
uint32 phase_mask;
DynamicTreeIntersectionCallback(uint32 phasemask) : did_hit(false), phase_mask(phasemask) {}
- bool operator()(const Ray& r, const GameObjectModel& obj, float& distance)
+ bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance)
{
did_hit = obj.intersectRay(r, distance, true, phase_mask);
return did_hit;
@@ -163,7 +167,7 @@ struct DynamicTreeIntersectionCallback_WithLogger
{
sLog->outDebug(LOG_FILTER_MAPS, "Dynamic Intersection log");
}
- bool operator()(const Ray& r, const GameObjectModel& obj, float& distance)
+ bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance)
{
sLog->outDebug(LOG_FILTER_MAPS, "testing intersection with %s", obj.name.c_str());
bool hit = obj.intersectRay(r, distance, true, phase_mask);
@@ -177,17 +181,20 @@ struct DynamicTreeIntersectionCallback_WithLogger
bool didHit() const { return did_hit;}
};
-bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray& ray, const Vector3& endPos, float& maxDist) const
+bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray& ray,
+ const G3D::Vector3& endPos, float& maxDist) const
{
float distance = maxDist;
DynamicTreeIntersectionCallback callback(phasemask);
- impl.intersectRay(ray, callback, distance, endPos);
+ impl->intersectRay(ray, callback, distance, endPos);
if (callback.didHit())
maxDist = distance;
return callback.didHit();
}
-bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const Vector3& startPos, const Vector3& endPos, Vector3& resultHit, float modifyDist) const
+bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const G3D::Vector3& startPos,
+ const G3D::Vector3& endPos, G3D::Vector3& resultHit,
+ float modifyDist) const
{
bool result = false;
float maxDist = (endPos - startPos).magnitude();
@@ -199,7 +206,7 @@ bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const Vector3& star
resultHit = endPos;
return false;
}
- Vector3 dir = (endPos - startPos)/maxDist; // direction with length of 1
+ G3D::Vector3 dir = (endPos - startPos)/maxDist; // direction with length of 1
G3D::Ray ray(startPos, dir);
float dist = maxDist;
if (getIntersectionTime(phasemask, ray, endPos, dist))
@@ -227,26 +234,26 @@ bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const Vector3& star
bool DynamicMapTree::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const
{
- Vector3 v1(x1, y1, z1), v2(x2, y2, z2);
+ G3D::Vector3 v1(x1, y1, z1), v2(x2, y2, z2);
float maxDist = (v2 - v1).magnitude();
if (!G3D::fuzzyGt(maxDist, 0) )
return true;
- Ray r(v1, (v2-v1) / maxDist);
+ G3D::Ray r(v1, (v2-v1) / maxDist);
DynamicTreeIntersectionCallback callback(phasemask);
- impl.intersectRay(r, callback, maxDist, v2);
+ impl->intersectRay(r, callback, maxDist, v2);
return !callback.did_hit;
}
float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const
{
- Vector3 v(x, y, z);
- Ray r(v, Vector3(0, 0, -1));
+ G3D::Vector3 v(x, y, z);
+ G3D::Ray r(v, G3D::Vector3(0, 0, -1));
DynamicTreeIntersectionCallback callback(phasemask);
- impl.intersectZAllignedRay(r, callback, maxSearchDist);
+ impl->intersectZAllignedRay(r, callback, maxSearchDist);
if (callback.didHit())
return v.z - maxSearchDist;
diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h
index ca199a9cd70..8e541fd453a 100644
--- a/src/server/collision/DynamicTree.h
+++ b/src/server/collision/DynamicTree.h
@@ -20,34 +20,36 @@
#ifndef _DYNTREE_H
#define _DYNTREE_H
-#include <G3D/Matrix3.h>
-#include <G3D/Vector3.h>
-#include <G3D/AABox.h>
-#include <G3D/Ray.h>
-
-//#include "ModelInstance.h"
#include "Define.h"
-//#include "GameObjectModel.h"
namespace G3D
{
+ class Ray;
class Vector3;
}
-using G3D::Vector3;
class GameObjectModel;
+struct DynTreeImpl;
class DynamicMapTree
{
- struct DynTreeImpl& impl;
+ DynTreeImpl *impl;
+
public:
DynamicMapTree();
~DynamicMapTree();
- bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const;
- bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray, const Vector3& endPos, float& maxDist) const;
- bool getObjectHitPos(uint32 phasemask, const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const;
+ bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2,
+ float z2, uint32 phasemask) const;
+
+ bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray,
+ const G3D::Vector3& endPos, float& maxDist) const;
+
+ bool getObjectHitPos(uint32 phasemask, const G3D::Vector3& pPos1,
+ const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos,
+ float pModifyDist) const;
+
float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;
void insert(const GameObjectModel&);
diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h
index c8e9628dff1..5de8e616d2b 100644
--- a/src/server/collision/Maps/MapTree.h
+++ b/src/server/collision/Maps/MapTree.h
@@ -72,7 +72,7 @@ namespace VMAP
bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const;
float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const;
bool getAreaInfo(G3D::Vector3 &pos, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const;
- bool GetLocationInfo(const Vector3 &pos, LocationInfo &info) const;
+ bool GetLocationInfo(const G3D::Vector3 &pos, LocationInfo &info) const;
bool InitMap(const std::string &fname, VMapManager2* vm);
void UnloadMap(VMapManager2* vm);
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index 54283389387..e166a860cd2 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -48,7 +48,10 @@ ModelList model_list;
void LoadGameObjectModelList()
{
+#ifndef NO_CORE_FUNCS
uint32 oldMSTime = getMSTime();
+#endif
+
FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
if (!model_list_file)
{
diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h
index ade9efbb040..cea32cfedfb 100644
--- a/src/server/collision/Models/WorldModel.h
+++ b/src/server/collision/Models/WorldModel.h
@@ -47,11 +47,11 @@ namespace VMAP
class WmoLiquid
{
public:
- WmoLiquid(uint32 width, uint32 height, const Vector3 &corner, uint32 type);
+ WmoLiquid(uint32 width, uint32 height, const G3D::Vector3 &corner, uint32 type);
WmoLiquid(const WmoLiquid &other);
~WmoLiquid();
WmoLiquid& operator=(const WmoLiquid &other);
- bool GetLiquidHeight(const Vector3 &pos, float &liqHeight) const;
+ bool GetLiquidHeight(const G3D::Vector3 &pos, float &liqHeight) const;
uint32 GetType() const { return iType; }
float *GetHeightStorage() { return iHeight; }
uint8 *GetFlagsStorage() { return iFlags; }
@@ -60,14 +60,14 @@ namespace VMAP
static bool readFromFile(FILE* rf, WmoLiquid* &liquid);
private:
WmoLiquid(): iHeight(0), iFlags(0) {};
- uint32 iTilesX; //!< number of tiles in x direction, each
+ uint32 iTilesX; //!< number of tiles in x direction, each
uint32 iTilesY;
- Vector3 iCorner; //!< the lower corner
- uint32 iType; //!< liquid type
- float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values
- uint8 *iFlags; //!< info if liquid tile is used
+ G3D::Vector3 iCorner; //!< the lower corner
+ uint32 iType; //!< liquid type
+ float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values
+ uint8 *iFlags; //!< info if liquid tile is used
public:
- void getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const;
+ void getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const;
};
/*! holding additional info for WMO group files */
@@ -76,16 +76,16 @@ namespace VMAP
public:
GroupModel(): iLiquid(0) {}
GroupModel(const GroupModel &other);
- GroupModel(uint32 mogpFlags, uint32 groupWMOID, const AABox &bound):
+ GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox &bound):
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) {}
~GroupModel() { delete iLiquid; }
//! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry!
- void setMeshData(std::vector<Vector3> &vert, std::vector<MeshTriangle> &tri);
+ void setMeshData(std::vector<G3D::Vector3> &vert, std::vector<MeshTriangle> &tri);
void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = NULL; }
bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const;
- bool IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const;
- bool GetLiquidLevel(const Vector3 &pos, float &liqHeight) const;
+ bool IsInsideObject(const G3D::Vector3 &pos, const G3D::Vector3 &down, float &z_dist) const;
+ bool GetLiquidLevel(const G3D::Vector3 &pos, float &liqHeight) const;
uint32 GetLiquidType() const;
bool writeToFile(FILE* wf);
bool readFromFile(FILE* rf);
@@ -96,12 +96,12 @@ namespace VMAP
G3D::AABox iBound;
uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor
uint32 iGroupWMOID;
- std::vector<Vector3> vertices;
+ std::vector<G3D::Vector3> vertices;
std::vector<MeshTriangle> triangles;
BIH meshTree;
WmoLiquid* iLiquid;
public:
- void getMeshData(std::vector<Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid);
+ void getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid);
};
/*! Holds a model (converted M2 or WMO) in its original coordinate space */
class WorldModel
diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h
index f38bf357a19..d1832c1ea06 100644
--- a/src/server/collision/RegularGrid.h
+++ b/src/server/collision/RegularGrid.h
@@ -3,18 +3,12 @@
#include <G3D/Ray.h>
-#include <G3D/AABox.h>
#include <G3D/Table.h>
#include <G3D/BoundsTrait.h>
#include <G3D/PositionTrait.h>
#include "Errors.h"
-using G3D::Vector2;
-using G3D::Vector3;
-using G3D::AABox;
-using G3D::Ray;
-
template<class Node>
struct NodeCreator{
static Node * makeNode(int /*x*/, int /*y*/) { return new Node();}
@@ -54,7 +48,7 @@ public:
void insert(const T& value)
{
- Vector3 pos;
+ G3D::Vector3 pos;
PositionFunc::getPosition(value, pos);
Node& node = getGridFor(pos.x, pos.y);
node.insert(value);
@@ -109,13 +103,13 @@ public:
}
template<typename RayCallback>
- void intersectRay(const Ray& ray, RayCallback& intersectCallback, float max_dist)
+ void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float max_dist)
{
intersectRay(ray, intersectCallback, max_dist, ray.origin() + ray.direction() * max_dist);
}
template<typename RayCallback>
- void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist, const Vector3& end)
+ void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist, const G3D::Vector3& end)
{
Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);
if (!cell.isValid())
@@ -191,7 +185,7 @@ public:
}
template<typename IsectCallback>
- void intersectPoint(const Vector3& point, IsectCallback& intersectCallback)
+ void intersectPoint(const G3D::Vector3& point, IsectCallback& intersectCallback)
{
Cell cell = Cell::ComputeCell(point.x, point.y);
if (!cell.isValid())
@@ -202,7 +196,7 @@ public:
// Optimized verson of intersectRay function for rays with vertical directions
template<typename RayCallback>
- void intersectZAllignedRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist)
+ void intersectZAllignedRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist)
{
Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);
if (!cell.isValid())
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 95a5a9a5116..7f0cec1a41d 100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -32,7 +32,7 @@ int AggressorAI::Permissible(const Creature* creature)
return PERMIT_BASE_NO;
}
-void AggressorAI::UpdateAI(const uint32 /*diff*/)
+void AggressorAI::UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -93,7 +93,7 @@ void CombatAI::EnterCombat(Unit* who)
}
}
-void CombatAI::UpdateAI(const uint32 diff)
+void CombatAI::UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -157,7 +157,7 @@ void CasterAI::EnterCombat(Unit* who)
}
}
-void CasterAI::UpdateAI(const uint32 diff)
+void CasterAI::UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -219,7 +219,7 @@ void ArcherAI::AttackStart(Unit* who)
me->GetMotionMaster()->MoveIdle();
}
-void ArcherAI::UpdateAI(const uint32 /*diff*/)
+void ArcherAI::UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -260,7 +260,7 @@ void TurretAI::AttackStart(Unit* who)
me->Attack(who, false);
}
-void TurretAI::UpdateAI(const uint32 /*diff*/)
+void TurretAI::UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -280,7 +280,7 @@ VehicleAI::VehicleAI(Creature* c) : CreatureAI(c), m_vehicle(c->GetVehicleKit())
}
//NOTE: VehicleAI::UpdateAI runs even while the vehicle is mounted
-void VehicleAI::UpdateAI(const uint32 diff)
+void VehicleAI::UpdateAI(uint32 diff)
{
CheckConditions(diff);
diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h
index 8b10a8d6190..315ff861da9 100644
--- a/src/server/game/AI/CoreAI/CombatAI.h
+++ b/src/server/game/AI/CoreAI/CombatAI.h
@@ -30,7 +30,7 @@ class AggressorAI : public CreatureAI
public:
explicit AggressorAI(Creature* c) : CreatureAI(c) {}
- void UpdateAI(const uint32);
+ void UpdateAI(uint32);
static int Permissible(const Creature*);
};
@@ -45,7 +45,7 @@ class CombatAI : public CreatureAI
void Reset();
void EnterCombat(Unit* who);
void JustDied(Unit* killer);
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
void SpellInterrupted(uint32 spellId, uint32 unTimeMs);
static int Permissible(const Creature*);
protected:
@@ -59,7 +59,7 @@ class CasterAI : public CombatAI
explicit CasterAI(Creature* c) : CombatAI(c) { m_attackDist = MELEE_RANGE; }
void InitializeAI();
void AttackStart(Unit* victim) { AttackStartCaster(victim, m_attackDist); }
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
void EnterCombat(Unit* /*who*/);
private:
float m_attackDist;
@@ -70,7 +70,7 @@ struct ArcherAI : public CreatureAI
public:
explicit ArcherAI(Creature* c);
void AttackStart(Unit* who);
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
static int Permissible(const Creature*);
protected:
@@ -83,7 +83,7 @@ struct TurretAI : public CreatureAI
explicit TurretAI(Creature* c);
bool CanAIAttack(const Unit* who) const;
void AttackStart(Unit* who);
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
static int Permissible(const Creature*);
protected:
@@ -97,7 +97,7 @@ struct VehicleAI : public CreatureAI
public:
explicit VehicleAI(Creature* c);
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
static int Permissible(const Creature*);
void Reset();
void MoveInLineOfSight(Unit*) {}
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h
index feb3bbefcb8..32a6e9a670c 100644
--- a/src/server/game/AI/CoreAI/GameObjectAI.h
+++ b/src/server/game/AI/CoreAI/GameObjectAI.h
@@ -40,7 +40,7 @@ class GameObjectAI
virtual void Reset() { }
// Pass parameters between AI
- virtual void DoAction(const int32 /*param = 0 */) {}
+ virtual void DoAction(int32 /*param = 0 */) {}
virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) {}
virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; }
diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp
index 2407b1f71e6..187a72bae92 100644
--- a/src/server/game/AI/CoreAI/PassiveAI.cpp
+++ b/src/server/game/AI/CoreAI/PassiveAI.cpp
@@ -24,7 +24,7 @@ PassiveAI::PassiveAI(Creature* c) : CreatureAI(c) { me->SetReactState(REACT_PASS
PossessedAI::PossessedAI(Creature* c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); }
NullCreatureAI::NullCreatureAI(Creature* c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); }
-void PassiveAI::UpdateAI(const uint32)
+void PassiveAI::UpdateAI(uint32)
{
if (me->isInCombat() && me->getAttackers().empty())
EnterEvadeMode();
@@ -35,7 +35,7 @@ void PossessedAI::AttackStart(Unit* target)
me->Attack(target, true);
}
-void PossessedAI::UpdateAI(const uint32 /*diff*/)
+void PossessedAI::UpdateAI(uint32 /*diff*/)
{
if (me->getVictim())
{
diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h
index cb513234be3..cb047ff364b 100644
--- a/src/server/game/AI/CoreAI/PassiveAI.h
+++ b/src/server/game/AI/CoreAI/PassiveAI.h
@@ -28,7 +28,7 @@ class PassiveAI : public CreatureAI
void MoveInLineOfSight(Unit*) {}
void AttackStart(Unit*) {}
- void UpdateAI(const uint32);
+ void UpdateAI(uint32);
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
};
@@ -40,7 +40,7 @@ class PossessedAI : public CreatureAI
void MoveInLineOfSight(Unit*) {}
void AttackStart(Unit* target);
- void UpdateAI(const uint32);
+ void UpdateAI(uint32);
void EnterEvadeMode() {}
void JustDied(Unit*);
@@ -56,7 +56,7 @@ class NullCreatureAI : public CreatureAI
void MoveInLineOfSight(Unit*) {}
void AttackStart(Unit*) {}
- void UpdateAI(const uint32) {}
+ void UpdateAI(uint32) {}
void EnterEvadeMode() {}
void OnCharmed(bool /*apply*/) {}
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 2792f68004f..dd32d2363d7 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -74,7 +74,7 @@ void PetAI::_stopAttack()
HandleReturnMovement();
}
-void PetAI::UpdateAI(const uint32 diff)
+void PetAI::UpdateAI(uint32 diff)
{
if (!me->isAlive() || !me->GetCharmInfo())
return;
diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h
index 674c3dc1748..efb088160f3 100644
--- a/src/server/game/AI/CoreAI/PetAI.h
+++ b/src/server/game/AI/CoreAI/PetAI.h
@@ -31,7 +31,7 @@ class PetAI : public CreatureAI
explicit PetAI(Creature* c);
- void UpdateAI(const uint32);
+ void UpdateAI(uint32);
static int Permissible(const Creature*);
void KilledUnit(Unit* /*victim*/);
diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp
index 31b9a82c534..b99885088d4 100644
--- a/src/server/game/AI/CoreAI/ReactorAI.cpp
+++ b/src/server/game/AI/CoreAI/ReactorAI.cpp
@@ -23,10 +23,7 @@
#include "ObjectAccessor.h"
#include "CreatureAIImpl.h"
-#define REACTOR_VISIBLE_RANGE (26.46f)
-
-int
-ReactorAI::Permissible(const Creature* creature)
+int ReactorAI::Permissible(const Creature* creature)
{
if (creature->isCivilian() || creature->IsNeutralToAll())
return PERMIT_BASE_REACTIVE;
@@ -34,24 +31,10 @@ ReactorAI::Permissible(const Creature* creature)
return PERMIT_BASE_NO;
}
-void
-ReactorAI::MoveInLineOfSight(Unit*)
-{
-}
-
-void
-ReactorAI::UpdateAI(const uint32 /*time_diff*/)
+void ReactorAI::UpdateAI(uint32 /*diff*/)
{
- // update i_victimGuid if me->getVictim() !=0 and changed
if (!UpdateVictim())
return;
- if (me->isAttackReady())
- {
- if (me->IsWithinMeleeRange(me->getVictim()))
- {
- me->AttackerStateUpdate(me->getVictim());
- me->resetAttackTimer();
- }
- }
+ DoMeleeAttackIfReady();
}
diff --git a/src/server/game/AI/CoreAI/ReactorAI.h b/src/server/game/AI/CoreAI/ReactorAI.h
index 39af09c4a9d..449458f39be 100644
--- a/src/server/game/AI/CoreAI/ReactorAI.h
+++ b/src/server/game/AI/CoreAI/ReactorAI.h
@@ -29,9 +29,9 @@ class ReactorAI : public CreatureAI
explicit ReactorAI(Creature* c) : CreatureAI(c) {}
- void MoveInLineOfSight(Unit*);
+ void MoveInLineOfSight(Unit*) {}
+ void UpdateAI(uint32 diff);
- void UpdateAI(const uint32);
static int Permissible(const Creature*);
};
#endif
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp
index 8846066fee4..45865c5dbc2 100644
--- a/src/server/game/AI/CoreAI/TotemAI.cpp
+++ b/src/server/game/AI/CoreAI/TotemAI.cpp
@@ -49,7 +49,7 @@ void TotemAI::EnterEvadeMode()
me->CombatStop(true);
}
-void TotemAI::UpdateAI(uint32 const /*diff*/)
+void TotemAI::UpdateAI(uint32 /*diff*/)
{
if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
return;
diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h
index f9a6acc7fce..897cfea1c44 100644
--- a/src/server/game/AI/CoreAI/TotemAI.h
+++ b/src/server/game/AI/CoreAI/TotemAI.h
@@ -35,7 +35,7 @@ class TotemAI : public CreatureAI
void AttackStart(Unit* victim);
void EnterEvadeMode();
- void UpdateAI(uint32 const diff);
+ void UpdateAI(uint32 diff);
static int Permissible(Creature const* creature);
private:
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index f7d5852e5a3..e0e9e68315d 100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -103,8 +103,7 @@ void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
if (unit->GetTypeId() == TYPEID_PLAYER)
me->AddAura(spellid, unit);
}
- }else
- return;
+ }
}
void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
@@ -118,8 +117,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
if (unit->GetTypeId() == TYPEID_PLAYER)
me->CastSpell(unit, spellid, triggered);
}
- }else
- return;
+ }
}
void UnitAI::DoCast(uint32 spellId)
@@ -239,7 +237,10 @@ void UnitAI::FillAISpellInfo()
}
//Enable PlayerAI when charmed
-void PlayerAI::OnCharmed(bool apply) { me->IsAIEnabled = apply; }
+void PlayerAI::OnCharmed(bool apply)
+{
+ me->IsAIEnabled = apply;
+}
void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/)
{
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 3cb7c15dce4..5ab97ac5978 100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -125,7 +125,7 @@ class UnitAI
virtual bool CanAIAttack(Unit const* /*target*/) const { return true; }
virtual void AttackStart(Unit* /*target*/);
- virtual void UpdateAI(uint32 const diff) = 0;
+ virtual void UpdateAI(uint32 diff) = 0;
virtual void InitializeAI() { if (!me->isDead()) Reset(); }
@@ -135,7 +135,7 @@ class UnitAI
virtual void OnCharmed(bool apply) = 0;
// Pass parameters between AI
- virtual void DoAction(int32 const /*param*/) {}
+ virtual void DoAction(int32 /*param*/) {}
virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) {}
@@ -278,7 +278,7 @@ class PlayerAI : public UnitAI
class SimpleCharmedAI : public PlayerAI
{
public:
- void UpdateAI(uint32 const diff);
+ void UpdateAI(uint32 diff);
SimpleCharmedAI(Player* player): PlayerAI(player) {}
};
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index 559240c4a3f..6c5cb5622b3 100644
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -313,96 +313,177 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c
class EventMap
{
- typedef std::map<uint32, uint32> StorageType;
+ /**
+ * Internal storage type.
+ * Key: Time as uint32 when the event should occur.
+ * Value: The event data as uint32.
+ *
+ * Structure of event data:
+ * - Bit 0 - 15: Event Id.
+ * - Bit 16 - 23: Group
+ * - Bit 24 - 31: Phase
+ * - Pattern: 0xPPGGEEEE
+ */
+ typedef std::multimap<uint32, uint32> EventStore;
public:
EventMap() : _time(0), _phase(0) {}
- // Returns current timer value, does not represent real dates/times
- uint32 GetTimer() const { return _time; }
-
- // Removes all events and clears phase
+ /**
+ * @name Reset
+ * @brief Removes all scheduled events and resets time and phase.
+ */
void Reset()
{
- _eventMap.clear(); _time = 0; _phase = 0;
+ _eventMap.clear();
+ _time = 0;
+ _phase = 0;
+ }
+
+ /**
+ * @name Update
+ * @brief Updates the timer of the event map.
+ * @param time Value to be added to time.
+ */
+ void Update(uint32 time)
+ {
+ _time += time;
}
- void Update(uint32 time) { _time += time; }
+ /**
+ * @name GetTimer
+ * @return Current timer value.
+ */
+ uint32 GetTimer() const
+ {
+ return _time;
+ }
- uint32 GetPhaseMask() const { return (_phase >> 24) & 0xFF; }
+ /**
+ * @name GetPhaseMask
+ * @return Active phases as mask.
+ */
+ uint8 GetPhaseMask() const
+ {
+ return _phase;
+ }
- bool Empty() const { return _eventMap.empty(); }
+ /**
+ * @name Empty
+ * @return True, if there are no events scheduled.
+ */
+ bool Empty() const
+ {
+ return _eventMap.empty();
+ }
- // Sets event phase, must be in range 1 - 8
- void SetPhase(uint32 phase)
+ /**
+ * @name SetPhase
+ * @brief Sets the phase of the map (absolute).
+ * @param phase Phase which should be set. Values: 1 - 8. 0 resets phase.
+ */
+ void SetPhase(uint8 phase)
{
- if (phase && phase < 8)
- _phase = (1 << (phase + 24));
- else if (!phase)
+ if (!phase)
_phase = 0;
+ else if (phase <= 8)
+ _phase = (1 << (phase - 1));
}
- // Creates new event entry in map with given id, time, group if given (1 - 8) and phase if given (1 - 8)
- // 0 for group/phase means it belongs to no group or runs in all phases
- void ScheduleEvent(uint32 eventId, uint32 time, uint32 groupId = 0, uint32 phase = 0)
+ /**
+ * @name AddPhase
+ * @brief Activates the given phase (bitwise).
+ * @param phase Phase which should be activated. Values: 1 - 8
+ */
+ void AddPhase(uint8 phase)
{
- time += _time;
- if (groupId && groupId < 9)
- eventId |= (1 << (groupId + 16));
- if (phase && phase < 8)
- eventId |= (1 << (phase + 24));
- StorageType::const_iterator itr = _eventMap.find(time);
- while (itr != _eventMap.end())
- {
- ++time;
- itr = _eventMap.find(time);
- }
+ if (phase && phase <= 8)
+ _phase |= (1 << (phase - 1));
+ }
- _eventMap.insert(StorageType::value_type(time, eventId));
+ /**
+ * @name RemovePhase
+ * @brief Deactivates the given phase (bitwise).
+ * @param phase Phase which should be deactivated. Values: 1 - 8.
+ */
+ void RemovePhase(uint8 phase)
+ {
+ if (phase && phase <= 8)
+ _phase &= ~(1 << (phase - 1));
}
- // Removes event with specified id and creates new entry for it
- void RescheduleEvent(uint32 eventId, uint32 time, uint32 groupId = 0, uint32 phase = 0)
+ /**
+ * @name ScheduleEvent
+ * @brief Creates new event entry in map.
+ * @param eventId The id of the new event.
+ * @param time The time in milliseconds until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
+ {
+ if (group && group <= 8)
+ eventId |= (1 << (group + 15));
+
+ if (phase && phase <= 8)
+ eventId |= (1 << (phase + 23));
+
+ _eventMap.insert(EventStore::value_type(_time + time, eventId));
+ }
+
+ /**
+ * @name RescheduleEvent
+ * @brief Cancels the given event and reschedules it.
+ * @param eventId The id of the event.
+ * @param time The time in milliseconds until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void RescheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
{
CancelEvent(eventId);
- ScheduleEvent(eventId, time, groupId, phase);
+ ScheduleEvent(eventId, time, group, phase);
}
- // Reschedules closest event
+ /**
+ * @name RepeatEvent
+ * @brief Cancels the closest event and reschedules it.
+ * @param time Time until the event occurs.
+ */
void RepeatEvent(uint32 time)
{
- if (_eventMap.empty())
+ if (Empty())
return;
uint32 eventId = _eventMap.begin()->second;
_eventMap.erase(_eventMap.begin());
- time += _time;
- StorageType::const_iterator itr = _eventMap.find(time);
- while (itr != _eventMap.end())
- {
- ++time;
- itr = _eventMap.find(time);
- }
-
- _eventMap.insert(StorageType::value_type(time, eventId));
+ ScheduleEvent(eventId, time);
}
- // Removes first event
+ /**
+ * @name PopEvent
+ * @brief Remove the first event in the map.
+ */
void PopEvent()
{
- if (!_eventMap.empty())
+ if (!Empty())
_eventMap.erase(_eventMap.begin());
}
- // Gets next event id to execute and removes it from map
+ /**
+ * @name ExecuteEvent
+ * @brief Returns the next event to execute and removes it from map.
+ * @return Id of the event to execute.
+ */
uint32 ExecuteEvent()
{
- while (!_eventMap.empty())
+ while (!Empty())
{
- StorageType::iterator itr = _eventMap.begin();
+ EventStore::iterator itr = _eventMap.begin();
+
if (itr->first > _time)
return 0;
- else if (_phase && (itr->second & 0xFF000000) && !(itr->second & _phase))
+ else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase))
_eventMap.erase(itr);
else
{
@@ -411,18 +492,24 @@ class EventMap
return eventId;
}
}
+
return 0;
}
- // Gets next event id to execute
+ /**
+ * @name GetEvent
+ * @brief Returns the next event to execute.
+ * @return Id of the event to execute.
+ */
uint32 GetEvent()
{
- while (!_eventMap.empty())
+ while (!Empty())
{
- StorageType::iterator itr = _eventMap.begin();
+ EventStore::iterator itr = _eventMap.begin();
+
if (itr->first > _time)
return 0;
- else if (_phase && (itr->second & 0xFF000000) && !(itr->second & _phase))
+ else if (_phase && (itr->second & 0xFF000000) && !(itr->second & (_phase << 24)))
_eventMap.erase(itr);
else
return (itr->second & 0x0000FFFF);
@@ -431,81 +518,150 @@ class EventMap
return 0;
}
- // Delay all events
+ /**
+ * @name DelayEvents
+ * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0.
+ * @param delay Amount of delay.
+ */
void DelayEvents(uint32 delay)
{
- if (delay < _time)
- _time -= delay;
- else
- _time = 0;
+ _time = delay < _time ? _time - delay : 0;
}
- // Delay all events having the specified Group
- void DelayEvents(uint32 delay, uint32 groupId)
+ /**
+ * @name DelayEvents
+ * @brief Delay all events of the same group.
+ * @param delay Amount of delay.
+ * @param group Group of the events.
+ */
+ void DelayEvents(uint32 delay, uint32 group)
{
- uint32 nextTime = _time + delay;
- uint32 groupMask = (1 << (groupId + 16));
- for (StorageType::iterator itr = _eventMap.begin(); itr != _eventMap.end() && itr->first < nextTime;)
+ if (!group || group > 8 || Empty())
+ return;
+
+ EventStore delayed;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
{
- if (itr->second & groupMask)
+ if (itr->second & (1 << (group + 15)))
{
- ScheduleEvent(itr->second, itr->first - _time + delay);
- _eventMap.erase(itr);
- itr = _eventMap.begin();
+ delayed.insert(EventStore::value_type(itr->first + delay, itr->second));
+ _eventMap.erase(itr++);
}
else
++itr;
}
+
+ _eventMap.insert(delayed.begin(), delayed.end());
}
- // Cancel events with specified id
+ /**
+ * @name CancelEvent
+ * @brief Cancels all events of the specified id.
+ * @param eventId Event id to cancel.
+ */
void CancelEvent(uint32 eventId)
{
- for (StorageType::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ if (Empty())
+ return;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
{
if (eventId == (itr->second & 0x0000FFFF))
- {
- _eventMap.erase(itr);
- itr = _eventMap.begin();
- }
+ _eventMap.erase(itr++);
else
++itr;
}
}
- // Cancel events belonging to specified group
- void CancelEventGroup(uint32 groupId)
+ /**
+ * @name CancelEventGroup
+ * @brief Cancel events belonging to specified group.
+ * @param group Group to cancel.
+ */
+ void CancelEventGroup(uint32 group)
{
- uint32 groupMask = (1 << (groupId + 16));
+ if (!group || group > 8 || Empty())
+ return;
- for (StorageType::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
{
- if (itr->second & groupMask)
- {
- _eventMap.erase(itr);
- itr = _eventMap.begin();
- }
+ if (itr->second & (1 << (group + 15)))
+ _eventMap.erase(itr++);
else
++itr;
}
}
- // Returns time of next event to execute
- // To get how much time remains substract _time
+ /**
+ * @name GetNextEventTime
+ * @brief Returns closest occurence of specified event.
+ * @param eventId Wanted event id.
+ * @return Time of found event.
+ */
uint32 GetNextEventTime(uint32 eventId) const
{
- for (StorageType::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
+ if (Empty())
+ return 0;
+
+ for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
if (eventId == (itr->second & 0x0000FFFF))
return itr->first;
return 0;
}
+ /**
+ * @name GetNextEventTime
+ * @return Time of next event.
+ */
+ uint32 GetNextEventTime() const
+ {
+ return Empty() ? 0 : _eventMap.begin()->first;
+ }
+
+ /**
+ * @name IsInPhase
+ * @brief Returns wether event map is in specified phase or not.
+ * @param phase Wanted phase.
+ * @return True, if phase of event map contains specified phase.
+ */
+ bool IsInPhase(uint8 phase)
+ {
+ return phase <= 8 && (!phase || _phase & (1 << (phase - 1)));
+ }
+
private:
+ /**
+ * @name _time
+ * @brief Internal timer.
+ *
+ * This does not represent the real date/time value.
+ * It's more like a stopwatch: It can run, it can be stopped,
+ * it can be resetted and so on. Events occur when this timer
+ * has reached their time value. Its value is changed in the
+ * Update method.
+ */
uint32 _time;
- uint32 _phase;
- StorageType _eventMap;
+ /**
+ * @name _phase
+ * @brief Phase mask of the event map.
+ *
+ * Contains the phases the event map is in. Multiple
+ * phases from 1 to 8 can be set with SetPhase or
+ * AddPhase. RemovePhase deactives a phase.
+ */
+ uint8 _phase;
+
+ /**
+ * @name _eventMap
+ * @brief Internal event storage map. Contains the scheduled events.
+ *
+ * See typedef at the beginning of the class for more
+ * details.
+ */
+ EventStore _eventMap;
};
enum AITarget
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp
index 920c1c25533..a09feb6e00f 100644
--- a/src/server/game/AI/CreatureAISelector.cpp
+++ b/src/server/game/AI/CreatureAISelector.cpp
@@ -132,16 +132,12 @@ namespace FactorySelector
const GameObjectAICreator* ai_factory = NULL;
GameObjectAIRegistry& ai_registry(*GameObjectAIRepository::instance());
+ // scriptname in db
if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go))
return scriptedAI;
ai_factory = ai_registry.GetRegistryItem(go->GetAIName());
- // scriptname in db
- if (!ai_factory)
- if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go))
- return scriptedAI;
-
//future goAI types go here
std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index 7172a187504..1fa29bba10a 100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -1012,7 +1012,7 @@ void CreatureEventAI::SpellHit(Unit* unit, const SpellInfo* spell)
ProcessEvent(*i, unit);
}
-void CreatureEventAI::UpdateAI(const uint32 diff)
+void CreatureEventAI::UpdateAI(uint32 diff)
{
//Check if we are in combat (also updates calls threat update code)
bool Combat = UpdateVictim();
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index fa4b2a709a6..23a2f79af67 100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -608,7 +608,7 @@ class CreatureEventAI : public CreatureAI
void SpellHit(Unit* unit, const SpellInfo* spell);
void DamageTaken(Unit* done_by, uint32& damage);
void HealReceived(Unit* /*done_by*/, uint32& /*addhealth*/) {}
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
void ReceiveEmote(Player* player, uint32 textEmote);
static int Permissible(const Creature*);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 9709cb0ecc2..5ef9ee09f1d 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -104,11 +104,19 @@ void ScriptedAI::AttackStartNoMove(Unit* who)
if (!who)
return;
- if (me->Attack(who, false))
+ if (me->Attack(who, true))
DoStartNoMovement(who);
}
-void ScriptedAI::UpdateAI(uint32 const /*diff*/)
+void ScriptedAI::AttackStart(Unit* who)
+{
+ if (IsCombatMovementAllowed())
+ CreatureAI::AttackStart(who);
+ else
+ AttackStartNoMove(who);
+}
+
+void ScriptedAI::UpdateAI(uint32 /*diff*/)
{
//Check if we have a current target
if (!UpdateVictim())
@@ -362,9 +370,7 @@ void ScriptedAI::SetEquipmentSlots(bool loadDefault, int32 mainHand /*= EQUIP_NO
{
if (loadDefault)
{
- if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(me->GetEntry()))
- me->LoadEquipment(creatureInfo->equipmentId, true);
-
+ me->LoadEquipment(me->GetOriginalEquipmentId(), true);
return;
}
@@ -439,15 +445,6 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
return true;
}
-void Scripted_NoMovementAI::AttackStart(Unit* target)
-{
- if (!target)
- return;
-
- if (me->Attack(target, true))
- DoStartNoMovement(target);
-}
-
// BossAI - for instanced bosses
BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature),
instance(creature->GetInstanceScript()),
@@ -569,7 +566,7 @@ void BossAI::SummonedCreatureDespawn(Creature* summon)
summons.Despawn(summon);
}
-void BossAI::UpdateAI(uint32 const diff)
+void BossAI::UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -628,7 +625,7 @@ void WorldBossAI::SummonedCreatureDespawn(Creature* summon)
summons.Despawn(summon);
}
-void WorldBossAI::UpdateAI(uint32 const diff)
+void WorldBossAI::UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index 50363f20ed5..8d7a28d4e6f 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -90,7 +90,7 @@ struct ScriptedAI : public CreatureAI
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) {}
//Called at World update tick
- virtual void UpdateAI(uint32 const diff);
+ virtual void UpdateAI(uint32 diff);
//Called at creature death
void JustDied(Unit* /*killer*/) {}
@@ -136,6 +136,9 @@ struct ScriptedAI : public CreatureAI
//Called at creature aggro either by MoveInLOS or Attack Start
void EnterCombat(Unit* /*victim*/) {}
+ // Called before EnterCombat even before the creature is in combat.
+ void AttackStart(Unit* /*target*/);
+
// *************
//AI Helper Functions
// *************
@@ -191,7 +194,11 @@ struct ScriptedAI : public CreatureAI
void SetEquipmentSlots(bool loadDefault, int32 mainHand = EQUIP_NO_CHANGE, int32 offHand = EQUIP_NO_CHANGE, int32 ranged = EQUIP_NO_CHANGE);
- //Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims
+ // Used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims
+ // NOTE: If you use SetCombatMovement while the creature is in combat, it will do NOTHING - This only affects AttackStart
+ // You should make the necessary to make it happen so.
+ // Remember that if you modified _isCombatMovementAllowed (e.g: using SetCombatMovement) it will not be reset at Reset().
+ // It will keep the last value you set.
void SetCombatMovement(bool allowMovement);
bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; }
@@ -269,15 +276,6 @@ struct ScriptedAI : public CreatureAI
bool _isHeroic;
};
-struct Scripted_NoMovementAI : public ScriptedAI
-{
- Scripted_NoMovementAI(Creature* creature) : ScriptedAI(creature) {}
- virtual ~Scripted_NoMovementAI() {}
-
- //Called at each attack of me by any victim
- void AttackStart(Unit* target);
-};
-
class BossAI : public ScriptedAI
{
public:
@@ -290,13 +288,13 @@ class BossAI : public ScriptedAI
void JustSummoned(Creature* summon);
void SummonedCreatureDespawn(Creature* summon);
- virtual void UpdateAI(uint32 const diff);
+ virtual void UpdateAI(uint32 diff);
// Hook used to execute events scheduled into EventMap without the need
// to override UpdateAI
// note: You must re-schedule the event within this method if the event
// is supposed to run more than once
- virtual void ExecuteEvent(uint32 const /*eventId*/) { }
+ virtual void ExecuteEvent(uint32 /*eventId*/) { }
void Reset() { _Reset(); }
void EnterCombat(Unit* /*who*/) { _EnterCombat(); }
@@ -338,13 +336,13 @@ class WorldBossAI : public ScriptedAI
void JustSummoned(Creature* summon);
void SummonedCreatureDespawn(Creature* summon);
- virtual void UpdateAI(uint32 const diff);
+ virtual void UpdateAI(uint32 diff);
// Hook used to execute events scheduled into EventMap without the need
// to override UpdateAI
// note: You must re-schedule the event within this method if the event
// is supposed to run more than once
- virtual void ExecuteEvent(uint32 const /*eventId*/) { }
+ virtual void ExecuteEvent(uint32 /*eventId*/) { }
void Reset() { _Reset(); }
void EnterCombat(Unit* /*who*/) { _EnterCombat(); }
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 3f5952a210d..b43cd1e7cd4 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -205,7 +205,7 @@ bool npc_escortAI::IsPlayerOrGroupInRange()
return false;
}
-void npc_escortAI::UpdateAI(uint32 const diff)
+void npc_escortAI::UpdateAI(uint32 diff)
{
//Waypoint Updating
if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->getVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING))
@@ -293,7 +293,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
UpdateEscortAI(diff);
}
-void npc_escortAI::UpdateEscortAI(uint32 const /*diff*/)
+void npc_escortAI::UpdateEscortAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 4b4f3656a8d..4a350acab2c 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -54,7 +54,7 @@ struct npc_escortAI : public ScriptedAI
void EnterEvadeMode();
- void UpdateAI(uint32 const diff); //the "internal" update, calls UpdateEscortAI()
+ void UpdateAI(uint32 diff); //the "internal" update, calls UpdateEscortAI()
virtual void UpdateEscortAI(uint32 const diff); //used when it's needed to add code in update (abilities, scripted events, etc)
void MovementInform(uint32, uint32);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 96209084240..63d5ad1fd05 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -184,7 +184,7 @@ void FollowerAI::EnterEvadeMode()
Reset();
}
-void FollowerAI::UpdateAI(const uint32 uiDiff)
+void FollowerAI::UpdateAI(uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !me->getVictim())
{
@@ -246,7 +246,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
UpdateFollowerAI(uiDiff);
}
-void FollowerAI::UpdateFollowerAI(const uint32 /*uiDiff*/)
+void FollowerAI::UpdateFollowerAI(uint32 /*uiDiff*/)
{
if (!UpdateVictim())
return;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
index 1c81b5f73fc..ccc8af6197a 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
@@ -38,8 +38,8 @@ class FollowerAI : public ScriptedAI
void JustRespawned();
- void UpdateAI(const uint32); //the "internal" update, calls UpdateFollowerAI()
- virtual void UpdateFollowerAI(const uint32); //used when it's needed to add code in update (abilities, scripted events, etc)
+ void UpdateAI(uint32); //the "internal" update, calls UpdateFollowerAI()
+ virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc)
void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = NULL);
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index e568a36abc4..30cc3cf246b 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -330,7 +330,7 @@ void SmartAI::UpdatePath(const uint32 diff)
}
}
-void SmartAI::UpdateAI(const uint32 diff)
+void SmartAI::UpdateAI(uint32 diff)
{
GetScript()->OnUpdate(diff);
UpdatePath(diff);
@@ -422,6 +422,9 @@ void SmartAI::MovepointReached(uint32 id)
void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
{
+ if ((MovementType == POINT_MOTION_TYPE && Data == SMART_ESCORT_LAST_OOC_POINT) || MovementType == FOLLOW_MOTION_TYPE)
+ me->ClearUnitState(UNIT_STATE_EVADE);
+
GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, NULL, MovementType, Data);
if (MovementType != POINT_MOTION_TYPE || !HasEscortState(SMART_ESCORT_ESCORTING))
return;
@@ -430,23 +433,25 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
void SmartAI::RemoveAuras()
{
- // Only loop throught the applied auras, because here is where all auras on the current unit are stored
- Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras();
- for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end(); ++iter)
+ Unit::AuraApplicationMap& appliedAuras = me->GetAppliedAuras();
+ for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
{
Aura const* aura = iter->second->GetBase();
- if (!aura->GetSpellInfo()->IsPassive() && !aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCaster() != me)
- me->RemoveAurasDueToSpell(aura->GetId());
+ if (!aura->IsPassive() && !aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCasterGUID() != me->GetGUID())
+ me->RemoveAura(iter);
+ else
+ ++iter;
}
}
void SmartAI::EnterEvadeMode()
{
- if (!me->isAlive())
+ if (!me->isAlive() || me->IsInEvadeMode())
return;
RemoveAuras();
+ me->AddUnitState(UNIT_STATE_EVADE);
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon();
@@ -693,7 +698,7 @@ void SmartAI::OnCharmed(bool apply)
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply);
}
-void SmartAI::DoAction(const int32 param)
+void SmartAI::DoAction(int32 param)
{
GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, NULL, param);
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index ab2ffb7229d..b5b92efdcd2 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -111,7 +111,7 @@ class SmartAI : public CreatureAI
void HealReceived(Unit* doneBy, uint32& addhealth);
// Called at World update tick
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
// Called at text emote receive from player
void ReceiveEmote(Player* player, uint32 textEmote);
@@ -147,7 +147,7 @@ class SmartAI : public CreatureAI
bool CanAIAttack(const Unit* who) const;
// Used in scripts to share variables
- void DoAction(const int32 param = 0);
+ void DoAction(int32 param = 0);
// Used in scripts to share variables
uint32 GetData(uint32 id = 0) const;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 86d86739bc9..bc94169687c 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1459,15 +1459,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (Creature* npc = (*itr)->ToCreature())
{
uint32 slot[3];
- if (e.action.equip.entry)
+ int8 equipId = (int8)e.action.equip.entry;
+ if (equipId)
{
- EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.action.equip.entry);
+ EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(npc->GetEntry(), equipId);
if (!einfo)
{
- sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry());
return;
}
- npc->SetCurrentEquipmentId(e.action.equip.entry);
+ npc->SetCurrentEquipmentId(equipId);
slot[0] = einfo->ItemEntry[0];
slot[1] = einfo->ItemEntry[1];
slot[2] = einfo->ItemEntry[2];
@@ -1478,11 +1479,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
slot[1] = e.action.equip.slot2;
slot[2] = e.action.equip.slot3;
}
- if (!e.action.equip.mask || e.action.equip.mask & 1)
+ if (!e.action.equip.mask || (e.action.equip.mask & 1))
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, slot[0]);
- if (!e.action.equip.mask || e.action.equip.mask & 2)
+ if (!e.action.equip.mask || (e.action.equip.mask & 2))
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, slot[1]);
- if (!e.action.equip.mask || e.action.equip.mask & 4)
+ if (!e.action.equip.mask || (e.action.equip.mask & 4))
npc->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, slot[2]);
}
}
@@ -1893,12 +1894,19 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_JUMP_TO_POS:
{
- if (!me)
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
break;
- me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (Creature* creature = (*itr)->ToCreature())
+ {
+ creature->GetMotionMaster()->Clear();
+ creature->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
+ }
// TODO: Resume path when reached jump location
+
+ delete targets;
break;
}
case SMART_ACTION_GO_SET_LOOT_STATE:
@@ -1977,23 +1985,87 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_SET_HOME_POS:
{
- if (!me)
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
break;
- if (e.GetTargetType() == SMART_TARGET_SELF)
- me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
- else if (e.GetTargetType() == SMART_TARGET_POSITION)
- me->SetHomePosition(e.target.x, e.target.y, e.target.z, e.target.o);
- else
- sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SET_HOME_POS is not using SMART_TARGET_SELF or SMART_TARGET_POSITION, skipping");
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (IsCreature(*itr))
+ {
+ if (e.GetTargetType() == SMART_TARGET_SELF)
+ (*itr)->ToCreature()->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
+ else if (e.GetTargetType() == SMART_TARGET_POSITION)
+ (*itr)->ToCreature()->SetHomePosition(e.target.x, e.target.y, e.target.z, e.target.o);
+ else
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SET_HOME_POS is not using SMART_TARGET_SELF or SMART_TARGET_POSITION, skipping");
+ }
- break;
+ delete targets;
+ break;
}
case SMART_ACTION_SET_HEALTH_REGEN:
{
- if (!me || me->GetTypeId() != TYPEID_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()->setRegeneratingHealth(e.action.setHealthRegen.regenHealth ? true : false);
+
+ delete targets;
+ break;
+ }
+ case SMART_ACTION_SET_ROOT:
+ {
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
+ break;
+
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (IsCreature(*itr))
+ (*itr)->ToCreature()->SetControlled(e.action.setRoot.root ? true : false, UNIT_STATE_ROOT);
+
+ delete targets;
+ break;
+ }
+ case SMART_ACTION_SET_GO_FLAG:
+ {
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
+ break;
+
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (IsGameObject(*itr))
+ (*itr)->ToGameObject()->SetUInt32Value(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
+
+ delete targets;
+ break;
+ }
+ case SMART_ACTION_ADD_GO_FLAG:
+ {
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
+ break;
+
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (IsGameObject(*itr))
+ (*itr)->ToGameObject()->SetFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
+
+ delete targets;
+ break;
+ }
+ case SMART_ACTION_REMOVE_GO_FLAG:
+ {
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
break;
- me->setRegeneratingHealth(e.action.setHealthRegen.regenHealth ? true : false);
+
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ if (IsGameObject(*itr))
+ (*itr)->ToGameObject()->RemoveFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
+
+ delete targets;
break;
}
default:
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index a49ae031e63..f140afe1295 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -906,6 +906,10 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SEND_TARGET_TO_TARGET:
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:
break;
default:
sLog->outError(LOG_FILTER_SQL, "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 c88ef206b00..133c227f825 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -426,7 +426,6 @@ enum SMART_ACTION
SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue(+pct, -flat)
SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to dismount)
SMART_ACTION_SET_INGAME_PHASE_MASK = 44, // mask
-
SMART_ACTION_SET_DATA = 45, // Field, Data (only creature TODO)
SMART_ACTION_MOVE_FORWARD = 46, // distance
SMART_ACTION_SET_VISIBILITY = 47, // on/off
@@ -449,7 +448,6 @@ enum SMART_ACTION
SMART_ACTION_STORE_TARGET_LIST = 64, // varID,
SMART_ACTION_WP_RESUME = 65, // none
SMART_ACTION_SET_ORIENTATION = 66, //
-
SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance
SMART_ACTION_PLAYMOVIE = 68, // entry
SMART_ACTION_MOVE_TO_POS = 69, // PointId, xyz
@@ -486,8 +484,12 @@ enum SMART_ACTION
SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id
SMART_ACTION_SET_HOME_POS = 101, // none
SMART_ACTION_SET_HEALTH_REGEN = 102, // 0/1
+ SMART_ACTION_SET_ROOT = 103, // off/on
+ SMART_ACTION_SET_GO_FLAG = 104, // Flags
+ SMART_ACTION_ADD_GO_FLAG = 105, // Flags
+ SMART_ACTION_REMOVE_GO_FLAG = 106, // Flags
- SMART_ACTION_END = 103
+ SMART_ACTION_END = 107
};
struct SmartAction
@@ -919,6 +921,16 @@ struct SmartAction
uint32 regenHealth;
} setHealthRegen;
+ struct
+ {
+ uint32 root;
+ } setRoot;
+
+ struct
+ {
+ uint32 flag;
+ } goFlag;
+
//! Note for any new future actions
//! All parameters must have type uint32
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 3c3eded1f68..7172efaac0e 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -17,6 +17,7 @@
*/
#include "AccountMgr.h"
+#include "Config.h"
#include "DatabaseEnv.h"
#include "ObjectAccessor.h"
#include "Player.h"
@@ -28,6 +29,18 @@ AccountMgr::AccountMgr()
{
}
+AccountMgr::~AccountMgr()
+{
+ for (RBACPermissionsContainer::iterator itr = _permissions.begin(); itr != _permissions.end(); ++itr)
+ delete itr->second;
+
+ for (RBACRolesContainer::iterator itr = _roles.begin(); itr != _roles.end(); ++itr)
+ delete itr->second;
+
+ for (RBACGroupsContainer::iterator itr = _groups.begin(); itr != _groups.end(); ++itr)
+ delete itr->second;
+}
+
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password)
{
if (utf8length(username) > MAX_ACCOUNT_STR)
@@ -44,12 +57,22 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
stmt->setString(0, username);
stmt->setString(1, CalculateShaPassHash(username, password));
- LoginDatabase.Execute(stmt);
+ LoginDatabase.DirectExecute(stmt); // Enforce saving, otherwise AddGroup can fail
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS_INIT);
LoginDatabase.Execute(stmt);
+ // Add default rbac groups for that security level
+ RBACData* rbac = new RBACData(GetId(username), username, -1);
+ // No need to Load From DB, as it's new data
+
+ RBACGroupContainer const& groupsToAdd = _defaultSecGroups[0]; // 0: Default sec level
+ for (RBACGroupContainer::const_iterator it = groupsToAdd.begin(); it != groupsToAdd.end(); ++it)
+ rbac->AddGroup(*it, -1);
+
+ delete rbac;
+
return AOR_OK; // everything's fine
}
@@ -175,6 +198,14 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPass
LoginDatabase.Execute(stmt);
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_VS);
+
+ stmt->setString(0, "");
+ stmt->setString(1, "");
+ stmt->setString(2, username);
+
+ LoginDatabase.Execute(stmt);
+
return AOR_OK;
}
@@ -303,3 +334,226 @@ bool AccountMgr::IsConsoleAccount(uint32 gmlevel)
{
return gmlevel == SEC_CONSOLE;
}
+
+void AccountMgr::LoadRBAC()
+{
+ uint32 oldMSTime = getMSTime();
+ uint32 count1 = 0;
+ uint32 count2 = 0;
+ uint32 count3 = 0;
+
+ QueryResult result = LoginDatabase.Query("SELECT id, name FROM rbac_permissions");
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SQL, ">> Loaded 0 account permission definitions. DB table `rbac_permissions` is empty.");
+ return;
+ }
+
+ do
+ {
+ Field* field = result->Fetch();
+ uint32 id = field[0].GetUInt32();
+ _permissions[id] = new RBACPermission(id, field[1].GetString());
+ ++count1;
+ }
+ while (result->NextRow());
+
+ result = LoginDatabase.Query("SELECT id, name FROM rbac_roles");
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SQL, ">> Loaded 0 account role definitions. DB table `rbac_roles` is empty.");
+ return;
+ }
+
+ do
+ {
+ Field* field = result->Fetch();
+ uint32 id = field[0].GetUInt32();
+ _roles[id] = new RBACRole(id, field[1].GetString());
+ ++count2;
+ }
+ while (result->NextRow());
+
+ result = LoginDatabase.Query("SELECT roleId, permissionId FROM rbac_role_permissions");
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SQL, ">> Loaded 0 account role-permission definitions. DB table `rbac_role_permissions` is empty.");
+ return;
+ }
+
+ do
+ {
+ Field* field = result->Fetch();
+ uint32 id = field[0].GetUInt32();
+ RBACRole* role = _roles[id];
+ role->GrantPermission(field[1].GetUInt32());
+ }
+ while (result->NextRow());
+
+ result = LoginDatabase.Query("SELECT id, name FROM rbac_groups");
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SQL, ">> Loaded 0 account group definitions. DB table `rbac_groups` is empty.");
+ return;
+ }
+
+ do
+ {
+ Field* field = result->Fetch();
+ uint32 id = field[0].GetUInt32();
+ _groups[id] = new RBACGroup(id, field[1].GetString());
+ ++count3;
+ }
+ while (result->NextRow());
+
+ result = LoginDatabase.Query("SELECT groupId, roleId FROM rbac_group_roles");
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SQL, ">> Loaded 0 account group-role definitions. DB table `rbac_group_roles` is empty.");
+ return;
+ }
+
+ do
+ {
+ Field* field = result->Fetch();
+ uint32 id = field[0].GetUInt32();
+ RBACGroup* group = _groups[id];
+ group->GrantRole(field[1].GetUInt32());
+ }
+ while (result->NextRow());
+
+ result = LoginDatabase.Query("SELECT secId, groupId FROM rbac_security_level_groups ORDER by secId ASC");
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SQL, ">> Loaded 0 account default groups for security levels definitions. DB table `rbac_security_level_groups` is empty.");
+ return;
+ }
+
+ uint8 lastSecId = 255;
+ RBACGroupContainer* groups = NULL;
+ do
+ {
+ Field* field = result->Fetch();
+ uint8 secId = field[0].GetUInt8();
+
+ if (lastSecId != secId)
+ groups = &_defaultSecGroups[secId];
+
+ groups->insert(field[1].GetUInt32());
+ }
+ while (result->NextRow());
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u permission definitions, %u role definitions and %u group definitions in %u ms", count1, count2, count3, GetMSTimeDiffToNow(oldMSTime));
+
+ // Load default groups to be added to any RBAC Object.
+ std::string defaultGroups = ConfigMgr::GetStringDefault("RBAC.DefaultGroups", "");
+ Tokenizer tokens(defaultGroups, ',');
+ for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
+ if (uint32 groupId = atoi(*itr))
+ _defaultGroups.insert(groupId);
+}
+
+void AccountMgr::UpdateAccountAccess(RBACData* rbac, uint32 accountId, uint8 securityLevel, int32 realmId)
+{
+ int32 serverRealmId = realmId != -1 ? realmId : ConfigMgr::GetIntDefault("RealmID", 0);
+ bool needDelete = false;
+ if (!rbac)
+ {
+ needDelete = true;
+ rbac = new RBACData(accountId, "", serverRealmId);
+ rbac->LoadFromDB();
+ }
+
+ // Get max security level and realm (checking current realm and -1)
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_BY_ID);
+ stmt->setUInt32(0, accountId);
+ stmt->setInt32(1, serverRealmId);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+ if (result)
+ {
+ do
+ {
+ Field* field = result->Fetch();
+ uint8 secLevel = field[0].GetUInt8();
+ int32 realmId = field[1].GetUInt32();
+
+ RBACGroupContainer const& groupsToRemove = _defaultSecGroups[secLevel];
+ for (RBACGroupContainer::const_iterator it = groupsToRemove.begin(); it != groupsToRemove.end(); ++it)
+ rbac->RemoveGroup(*it, realmId);
+ }
+ while (result->NextRow());
+ }
+
+ // Add new groups depending on the new security Level
+ RBACGroupContainer const& groupsToAdd = _defaultSecGroups[securityLevel];
+ for (RBACGroupContainer::const_iterator it = groupsToAdd.begin(); it != groupsToAdd.end(); ++it)
+ rbac->AddGroup(*it, realmId);
+
+ if (needDelete)
+ delete rbac;
+
+ // Delete old security level from DB
+ if (realmId == -1)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS);
+ stmt->setUInt32(0, accountId);
+ LoginDatabase.Execute(stmt);
+ }
+ else
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM);
+ stmt->setUInt32(0, accountId);
+ stmt->setUInt32(1, realmId);
+ LoginDatabase.Execute(stmt);
+ }
+
+ // Add new security level
+ if (securityLevel)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS);
+ stmt->setUInt32(0, accountId);
+ stmt->setUInt8(1, securityLevel);
+ stmt->setInt32(2, realmId);
+ LoginDatabase.Execute(stmt);
+ }
+}
+
+RBACGroup const* AccountMgr::GetRBACGroup(uint32 group) const
+{
+ RBACGroupsContainer::const_iterator it = _groups.find(group);
+ if (it != _groups.end())
+ return it->second;
+
+ return NULL;
+}
+
+RBACRole const* AccountMgr::GetRBACRole(uint32 role) const
+{
+ RBACRolesContainer::const_iterator it = _roles.find(role);
+ if (it != _roles.end())
+ return it->second;
+
+ return NULL;
+}
+
+RBACPermission const* AccountMgr::GetRBACPermission(uint32 permission) const
+{
+ RBACPermissionsContainer::const_iterator it = _permissions.find(permission);
+ if (it != _permissions.end())
+ return it->second;
+
+ return NULL;
+}
+
+bool AccountMgr::HasPermission(uint32 accountId, uint32 permission, uint32 realmId)
+{
+ if (!accountId)
+ return false;
+
+ RBACData* rbac = new RBACData(accountId, "", realmId);
+ rbac->LoadFromDB();
+ bool hasPermission = rbac->HasPermission(permission);
+ delete rbac;
+
+ return hasPermission;
+}
diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h
index c8de5688e73..28373456994 100644
--- a/src/server/game/Accounts/AccountMgr.h
+++ b/src/server/game/Accounts/AccountMgr.h
@@ -19,8 +19,7 @@
#ifndef _ACCMGR_H
#define _ACCMGR_H
-#include "Define.h"
-#include <string>
+#include "RBAC.h"
#include <ace/Singleton.h>
enum AccountOpResult
@@ -35,15 +34,21 @@ enum AccountOpResult
#define MAX_ACCOUNT_STR 16
+typedef std::map<uint32, RBACPermission*> RBACPermissionsContainer;
+typedef std::map<uint32, RBACRole*> RBACRolesContainer;
+typedef std::map<uint32, RBACGroup*> RBACGroupsContainer;
+typedef std::map<uint32, RBACGroupContainer> RBACDefaultSecurityGroupContainer;
+
class AccountMgr
{
friend class ACE_Singleton<AccountMgr, ACE_Null_Mutex>;
private:
AccountMgr();
+ ~AccountMgr();
public:
- static AccountOpResult CreateAccount(std::string username, std::string password);
+ AccountOpResult CreateAccount(std::string username, std::string password);
static AccountOpResult DeleteAccount(uint32 accountId);
static AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword);
static AccountOpResult ChangePassword(uint32 accountId, std::string newPassword);
@@ -62,6 +67,26 @@ class AccountMgr
static bool IsGMAccount(uint32 gmlevel);
static bool IsAdminAccount(uint32 gmlevel);
static bool IsConsoleAccount(uint32 gmlevel);
+ static bool HasPermission(uint32 accountId, uint32 permission, uint32 realmId);
+
+ void UpdateAccountAccess(RBACData* rbac, uint32 accountId, uint8 securityLevel, int32 realmId);
+
+ void LoadRBAC();
+ RBACGroup const* GetRBACGroup(uint32 group) const;
+ RBACRole const* GetRBACRole(uint32 role) const;
+ RBACPermission const* GetRBACPermission(uint32 permission) const;
+
+ RBACGroupsContainer const& GetRBACGroupList() const { return _groups; }
+ RBACRolesContainer const& GetRBACRoleList() const { return _roles; }
+ RBACPermissionsContainer const& GetRBACPermissionList() const { return _permissions; }
+ RBACGroupContainer const& GetRBACDefaultGroups() const { return _defaultGroups; }
+
+ private:
+ RBACPermissionsContainer _permissions;
+ RBACRolesContainer _roles;
+ RBACGroupsContainer _groups;
+ RBACDefaultSecurityGroupContainer _defaultSecGroups;
+ RBACGroupContainer _defaultGroups;
};
#define sAccountMgr ACE_Singleton<AccountMgr, ACE_Null_Mutex>::instance()
diff --git a/src/server/game/Accounts/RBAC.cpp b/src/server/game/Accounts/RBAC.cpp
new file mode 100644
index 00000000000..121c9faae76
--- /dev/null
+++ b/src/server/game/Accounts/RBAC.cpp
@@ -0,0 +1,341 @@
+/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "RBAC.h"
+#include "AccountMgr.h"
+#include "DatabaseEnv.h"
+
+RBACCommandResult RBACData::AddGroup(uint32 groupId, int32 realmId /* = 0 */)
+{
+ // Check if group Id exists
+ RBACGroup const* group = sAccountMgr->GetRBACGroup(groupId);
+ if (!group)
+ return RBAC_ID_DOES_NOT_EXISTS;
+
+ // Already added?
+ std::pair<std::set<uint32>::iterator, bool> ret = _groups.insert(groupId);
+ if (!ret.second)
+ return RBAC_CANT_ADD_ALREADY_ADDED;
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_GROUP);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, groupId);
+ stmt->setInt32(2, realmId);
+ LoginDatabase.Execute(stmt);
+
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+RBACCommandResult RBACData::RemoveGroup(uint32 groupId, int32 realmId /* = 0 */)
+{
+ // could remove it?
+ if (!_groups.erase(groupId))
+ return RBAC_CANT_REVOKE_NOT_IN_LIST;
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_GROUP);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, groupId);
+ stmt->setInt32(2, realmId);
+ LoginDatabase.Execute(stmt);
+
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+RBACCommandResult RBACData::GrantRole(uint32 roleId, int32 realmId /* = 0*/)
+{
+ // Check if role Id exists
+ RBACRole const* role = sAccountMgr->GetRBACRole(roleId);
+ if (!role)
+ return RBAC_ID_DOES_NOT_EXISTS;
+
+ // Check if already added in denied list
+ if (_deniedRoles.find(roleId) != _deniedRoles.end())
+ return RBAC_IN_DENIED_LIST;
+
+ // Already added?
+ std::pair<std::set<uint32>::iterator, bool> ret = _grantedRoles.insert(roleId);
+ if (!ret.second)
+ return RBAC_CANT_ADD_ALREADY_ADDED;
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ SaveRole(roleId, true, realmId);
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+RBACCommandResult RBACData::DenyRole(uint32 roleId, int32 realmId /* = 0*/)
+{
+ // Check if role Id exists
+ RBACRole const* role = sAccountMgr->GetRBACRole(roleId);
+ if (!role)
+ return RBAC_ID_DOES_NOT_EXISTS;
+
+ // Check if already added in granted list
+ if (_grantedRoles.find(roleId) != _grantedRoles.end())
+ return RBAC_IN_GRANTED_LIST;
+
+ // Already added?
+ std::pair<std::set<uint32>::iterator, bool> ret = _deniedRoles.insert(roleId);
+ if (!ret.second)
+ return RBAC_CANT_ADD_ALREADY_ADDED;
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ SaveRole(roleId, false, realmId);
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+void RBACData::SaveRole(uint32 roleId, bool granted, int32 realmId)
+{
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_ROLE);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, roleId);
+ stmt->setBool(2, granted);
+ stmt->setInt32(3, realmId);
+ LoginDatabase.Execute(stmt);
+}
+
+RBACCommandResult RBACData::RevokeRole(uint32 roleId, int32 realmId /* = 0*/)
+{
+ uint8 revoked = _grantedRoles.erase(roleId) + _deniedRoles.erase(roleId);
+
+ // could remove it?
+ if (!revoked)
+ return RBAC_CANT_REVOKE_NOT_IN_LIST;
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_ROLE);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, roleId);
+ stmt->setInt32(2, realmId);
+ LoginDatabase.Execute(stmt);
+
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId /* = 0*/)
+{
+ // Check if permission Id exists
+ RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
+ if (!perm)
+ return RBAC_ID_DOES_NOT_EXISTS;
+
+ // Check if already added in denied list
+ if (_deniedPerms.test(permissionId))
+ return RBAC_IN_DENIED_LIST;
+
+ // Already added?
+ if (_grantedPerms.test(permissionId))
+ return RBAC_CANT_ADD_ALREADY_ADDED;
+
+ _grantedPerms.set(permissionId);
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ SavePermission(permissionId, true, realmId);
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* = 0*/)
+{
+ // Check if permission Id exists
+ RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
+ if (!perm)
+ return RBAC_ID_DOES_NOT_EXISTS;
+
+ // Check if already added in granted list
+ if (_grantedPerms.test(permissionId))
+ return RBAC_IN_GRANTED_LIST;
+
+ // Already added?
+ if (_deniedPerms.test(permissionId))
+ return RBAC_CANT_ADD_ALREADY_ADDED;
+
+ _deniedPerms.set(permissionId);
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ SavePermission(permissionId, false, realmId);
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+void RBACData::SavePermission(uint32 permission, bool granted, int32 realmId)
+{
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_PERMISSION);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, permission);
+ stmt->setBool(2, granted);
+ stmt->setInt32(3, realmId);
+ LoginDatabase.Execute(stmt);
+}
+
+RBACCommandResult RBACData::RevokePermission(uint32 permission, int32 realmId /* = 0*/)
+{
+ // Check if it's present in any list
+ if (!_grantedPerms.test(permission) && !_deniedPerms.test(permission))
+ return RBAC_CANT_REVOKE_NOT_IN_LIST;
+
+ _grantedPerms.reset(permission);
+ _deniedPerms.reset(permission);
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_PERMISSION);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, permission);
+ stmt->setInt32(2, realmId);
+ LoginDatabase.Execute(stmt);
+
+ CalculateNewPermissions();
+ }
+
+ return RBAC_OK;
+}
+
+void RBACData::LoadFromDB()
+{
+ // Load account group that affect current realm
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_GROUPS);
+ stmt->setUInt32(0, GetId());
+ stmt->setInt32(1, GetRealmId());
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ AddGroup(fields[0].GetUInt32());
+ }
+ while (result->NextRow());
+ }
+
+ // Load account roles (granted and denied) that affect current realm
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_ROLES);
+ stmt->setUInt32(0, GetId());
+ stmt->setInt32(1, GetRealmId());
+ result = LoginDatabase.Query(stmt);
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ if (fields[1].GetBool())
+ GrantRole(fields[0].GetUInt32());
+ else
+ DenyRole(fields[0].GetUInt32());
+ }
+ while (result->NextRow());
+ }
+
+ // Load account permissions (granted and denied) that affect current realm
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS);
+ stmt->setUInt32(0, GetId());
+ stmt->setInt32(1, GetRealmId());
+
+ result = LoginDatabase.Query(stmt);
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ if (fields[1].GetBool())
+ GrantPermission(fields[0].GetUInt32());
+ else
+ DenyPermission(fields[0].GetUInt32());
+ }
+ while (result->NextRow());
+ }
+
+ // Add default groups
+ RBACGroupContainer const& groups = sAccountMgr->GetRBACDefaultGroups();
+ for (RBACGroupContainer::const_iterator itr = groups.begin(); itr != groups.end(); ++itr)
+ AddGroup(*itr);
+
+ // Force calculation of permissions, it wasn't performed at load time
+ // while adding groups, roles and permissions
+ CalculateNewPermissions();
+}
+
+void RBACData::CalculateNewPermissions()
+{
+ // Get the list of directly granted roles
+ RBACRoleContainer tempGrantedRoles = GetGrantedRoles();
+
+ // Add those roles inherited from groups
+ for (RBACGroupContainer::const_iterator itGroup = _groups.begin(); itGroup != _groups.end(); ++itGroup)
+ {
+ RBACGroup const* group = sAccountMgr->GetRBACGroup(*itGroup);
+ if (!group) // Should never happen due to foreign keys in DB
+ continue;
+
+ RBACRoleContainer const& roles = group->GetRoles();
+ for (RBACRoleContainer::const_iterator it = roles.begin(); it != roles.end(); ++it)
+ tempGrantedRoles.insert(*it);
+ }
+
+ // Get the list of granted permissions
+ _globalPerms = GetGrantedPermissions();
+
+ // Add those permissions inherited from roles granted
+ for (RBACRoleContainer::const_iterator it = tempGrantedRoles.begin(); it != tempGrantedRoles.end(); ++it)
+ if (RBACRole const* role = sAccountMgr->GetRBACRole(*it))
+ _globalPerms |= role->GetPermissions();
+
+ // Remove denied permissions from the list
+ _globalPerms &= ~GetDeniedPermissions();
+
+ // Remove those permissions inherited from denied roles
+ for (RBACRoleContainer::const_iterator it = _deniedRoles.begin(); it != _deniedRoles.end(); ++it)
+ if (RBACRole const* role = sAccountMgr->GetRBACRole(*it))
+ _globalPerms &= ~role->GetPermissions();
+}
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
new file mode 100644
index 00000000000..0bd193d3841
--- /dev/null
+++ b/src/server/game/Accounts/RBAC.h
@@ -0,0 +1,447 @@
+/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+* @file RBAC.h
+* @brief Role Based Access Control related classes definition
+*
+* This file contains all the classes and enums used to implement
+* Role Based Access Control
+*
+* RBAC Rules:
+* - Pemission: Defines an autorization to perform certain operation.
+* - Role: Set of permissions.
+* - Group: Set of roles.
+* - An Account can have multiple groups, roles and permissions.
+* - Account Groups can only be granted or revoked
+* - Account Roles and Permissions can be granted, denied or revoked
+* - Grant: Assignment of the object (role/permission) and allow it
+* - Deny: Assignment of the object (role/permission) and deny it
+* - Revoke: Removal of the object (role/permission) no matter if it was granted or denied
+* - Global Permissions are computed as:
+* Group Grants + Role Grants + User Grans - Role Grants - User Grants
+* - Groups, Roles and Permissions can be assigned by realm
+*/
+
+#ifndef _RBAC_H
+#define _RBAC_H
+
+#include "Define.h"
+#include <string>
+#include <bitset>
+#include <set>
+#include <map>
+
+enum RBACPermissions
+{
+ RBAC_PERM_INSTANT_LOGOUT = 1,
+ RBAC_PERM_SKIP_QUEUE = 2,
+ RBAC_PERM_JOIN_NORMAL_BG = 3,
+ RBAC_PERM_JOIN_RANDOM_BG = 4,
+ RBAC_PERM_JOIN_ARENAS = 5,
+ RBAC_PERM_JOIN_DUNGEON_FINDER = 6,
+ RBAC_PERM_PLAYER_COMMANDS = 7,
+ RBAC_PERM_MODERATOR_COMMANDS = 8,
+ RBAC_PERM_GAMEMASTER_COMMANDS = 9,
+ RBAC_PERM_ADMINISTRATOR_COMMANDS = 10,
+ RBAC_PERM_LOG_GM_TRADE = 11,
+ // Free = 12
+ RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES = 13,
+ RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_TEAMMASK = 14,
+ RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_CLASSMASK = 15,
+ RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RACEMASK = 16,
+ RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME = 17,
+ RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_HEROIC_CHARACTER = 18,
+ RBAC_PERM_SKIP_CHECK_CHAT_CHANNEL_REQ = 19,
+ RBAC_PERM_SKIP_CHECK_DISABLE_MAP = 20,
+ RBAC_PERM_SKIP_CHECK_MORE_TALENTS_THAN_ALLOWED = 21,
+ RBAC_PERM_SKIP_CHECK_CHAT_SPAM = 22,
+ RBAC_PERM_SKIP_CHECK_OVERSPEED_PING = 23,
+ RBAC_PERM_TWO_SIDE_CHARACTER_CREATION = 24,
+ RBAC_PERM_TWO_SIDE_INTERACTION_CHAT = 25,
+ RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL = 26,
+ RBAC_PERM_TWO_SIDE_INTERACTION_MAIL = 27,
+ RBAC_PERM_TWO_SIDE_WHO_LIST = 28,
+ RBAC_PERM_TWO_SIDE_ADD_FRIEND = 29,
+ RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY = 30,
+ RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS = 31,
+ RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET = 32,
+ RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR = 33,
+ RBAC_PERM_COMMANDS_APPEAR_IN_GM_LIST = 34,
+ RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS = 35,
+ RBAC_PERM_CAN_FILTER_WHISPERS = 36,
+ RBAC_PERM_CHAT_USE_STAFF_BADGE = 37,
+ RBAC_PERM_RESURRECT_WITH_FULL_HPS = 38,
+ RBAC_PERM_RESTORE_SAVED_GM_STATE = 39,
+ RBAC_PERM_ALLOW_GM_FRIEND = 40,
+ RBAC_PERM_USE_START_GM_LEVEL = 41,
+ RBAC_PERM_OPCODE_WORLD_TELEPORT = 42,
+ RBAC_PERM_OPCODE_WHOIS = 43,
+ RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE = 44,
+ RBAC_PERM_SILENTLY_JOIN_CHANNEL = 45,
+ RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR = 46,
+ RBAC_PERM_CHECK_FOR_LOWER_SECURITY = 47,
+ RBAC_PERM_MAX
+};
+
+enum RBACCommandResult
+{
+ RBAC_OK,
+ RBAC_CANT_ADD_ALREADY_ADDED,
+ RBAC_CANT_REVOKE_NOT_IN_LIST,
+ RBAC_IN_GRANTED_LIST,
+ RBAC_IN_DENIED_LIST,
+ RBAC_ID_DOES_NOT_EXISTS
+};
+
+typedef std::bitset<RBAC_PERM_MAX> RBACPermissionContainer;
+typedef std::set<uint32> RBACRoleContainer;
+typedef std::set<uint32> RBACGroupContainer;
+
+class RBACObject
+{
+ public:
+ RBACObject(uint32 id = 0, std::string const& name = ""):
+ _id(id), _name(name) { }
+
+ /// Gets the Name of the Object
+ std::string const& GetName() const { return _name; }
+ /// Gets the Id of the Object
+ uint32 GetId() const { return _id; }
+
+ private:
+ uint32 _id; ///> id of the object
+ std::string _name; ///> name of the object
+};
+
+/// Permission: Defines an autorization to perform certain operation
+class RBACPermission: public RBACObject
+{
+ public:
+ RBACPermission(uint32 id = 0, std::string const& name = ""):
+ RBACObject(id, name) { }
+};
+
+/// Set of Permissions
+class RBACRole: public RBACObject
+{
+ public:
+ RBACRole(uint32 id = 0, std::string const& name = ""):
+ RBACObject(id, name) { }
+
+ /// Gets the Permissions assigned to this role
+ RBACPermissionContainer const& GetPermissions() const { return _perms; }
+ /// Grants a Permission (Adds)
+ void GrantPermission(uint32 id) { _perms.set(id); }
+ /// Revokes a Permission (Removes)
+ void RevokePermission(uint32 id) { _perms.reset(id); }
+
+ private:
+ RBACPermissionContainer _perms; ///> Set of permissions
+};
+
+/// Set of Roles
+class RBACGroup: public RBACObject
+{
+ public:
+ RBACGroup(uint32 id = 0, std::string const& name = ""):
+ RBACObject(id, name) { }
+
+ /// Gets the Roles assigned to this group
+ RBACRoleContainer const& GetRoles() const { return _roles; }
+ /// Grants a Role (Adds)
+ void GrantRole(uint32 role) { _roles.insert(role); }
+ /// Revokes a Role (Removes)
+ void RevokeRole(uint32 role) { _roles.erase(role); }
+
+ private:
+ RBACRoleContainer _roles; ///> Set of Roles
+};
+
+/**
+ * @name RBACData
+ * @brief Contains all needed information about the acccount
+ *
+ * This class contains all the data needed to calculate the account permissions.
+ * RBACDAta is formed by group permissions and user permissions through:
+ * - Granted Groups, which contains roles, which contains permissions: Set of granted permissions
+ * - Granted Roles, which contains permissions: Set of granted permissions
+ * - Denied Roles, which contains permissions: Set of denied permissions
+ * - Granted Permissions
+ * - Denied Permissions
+ *
+ * Calculation of current Permissions: Granted permissions - Denied permissions
+ * - Granted permissions: through groups, through roles and directly assigned
+ * - Denied permissions: through roles and directly assigned
+ */
+class RBACData: public RBACObject
+{
+ public:
+ RBACData(uint32 id, std::string const& name, int32 realmId):
+ RBACObject(id, name), _realmId(realmId) { }
+
+ /**
+ * @name HasPermission
+ * @brief Checks if certain action is allowed
+ *
+ * Checks if certain action can be performed.
+ *
+ * @return grant or deny action
+ *
+ * Example Usage:
+ * @code
+ * bool Player::CanJoinArena(Battleground* bg)
+ * {
+ * return bg->isArena() && HasPermission(RBAC_PERM_JOIN_ARENA);
+ * }
+ * @endcode
+ */
+ bool HasPermission(uint32 permission) { return _globalPerms.test(permission); }
+
+ // Functions enabled to be used by command system
+ /// Returns all the granted permissions (after computation)
+ RBACPermissionContainer const& GetPermissions() const { return _globalPerms; }
+ /// Returns all the granted permissions
+ RBACPermissionContainer const& GetGrantedPermissions() const { return _grantedPerms; }
+ /// Returns all the denied permissions
+ RBACPermissionContainer const& GetDeniedPermissions() const { return _deniedPerms; }
+ /// Returns all the granted roles
+ RBACRoleContainer const& GetGrantedRoles() const { return _grantedRoles; }
+ /// Returns all the denied roles
+ RBACRoleContainer const& GetDeniedRoles() const { return _deniedRoles; }
+ /// Returns all the granted groups
+ RBACGroupContainer const& GetGroups() const { return _groups; }
+
+ /**
+ * @name AddGroup
+ * @brief Adds new group
+ *
+ * Add a new group to the account. If realm is 0 or the group can not be added
+ * No save to db action will be performed.
+ *
+ * Fails if group Id does not exists or group already present
+ *
+ * @param groupId group to be added
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to add the group
+ *
+ * Example Usage:
+ * @code
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 groupId = 2;
+ * if (rbac->AddGroup(groupId) == RBAC_OK)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Group %u succesfully added", groupId);
+ * @endcode
+ */
+ RBACCommandResult AddGroup(uint32 groupId, int32 realmId = 0);
+
+ /**
+ * @name RemoveGroup
+ * @brief Removes a group
+ *
+ * Removes a group from the account. If realm is 0 or the group can not be removed
+ * No save to db action will be performed. Any delete operation will always affect
+ * "all realms (-1)" in addition to the realm specified
+ *
+ * Fails if group not present
+ *
+ * @param groupId group to be removed
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to remove the group
+ *
+ * Example Usage:
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 groupId = 2;
+ * if (rbac->RemoveGroup(groupId) == RBAC_OK)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Group %u succesfully removed", groupId);
+ * @endcode
+ */
+ RBACCommandResult RemoveGroup(uint32 groupId, int32 realmId = 0);
+
+ /**
+ * @name GrantRole
+ * @brief Grants a role
+ *
+ * Grants a role to the account. If realm is 0 or the role can not be added
+ * No save to db action will be performed.
+ *
+ * Fails if role Id does not exists or role already granted or denied
+ *
+ * @param roleId role to be granted
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to grant the role
+ *
+ * Example Usage:
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 roleId = 2;
+ * if (rbac->GrantRole(roleId) == RBAC_IN_DENIED_LIST)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Failed to grant role %u, already denied", roleId);
+ * @endcode
+ */
+ RBACCommandResult GrantRole(uint32 roleId, int32 realmId = 0);
+
+ /**
+ * @name DenyRole
+ * @brief Denies a role
+ *
+ * Denied a role to the account. If realm is 0 or the role can not be added
+ * No save to db action will be performed.
+ *
+ * Fails if role Id does not exists or role already granted or denied
+ *
+ * @param roleId role to be denied
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to deny the role
+ *
+ * Example Usage:
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 roleId = 2;
+ * if (rbac->DenyRole(roleId) == RBAC_ID_DOES_NOT_EXISTS)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Role Id %u does not exists", roleId);
+ * @endcode
+ */
+ RBACCommandResult DenyRole(uint32 roleId, int32 realmId = 0);
+
+ /**
+ * @name RevokeRole
+ * @brief Removes a role
+ *
+ * Removes a role from the account. If realm is 0 or the role can not be removed
+ * No save to db action will be performed. Any delete operation will always affect
+ * "all realms (-1)" in addition to the realm specified
+ *
+ * Fails if role not present
+ *
+ * @param roleId role to be removed
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to remove the role
+ *
+ * Example Usage:
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 roleId = 2;
+ * if (rbac->RevokeRole(roleId) == RBAC_OK)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Role %u succesfully removed", roleId);
+ * @endcode
+ */
+ RBACCommandResult RevokeRole(uint32 roleId, int32 realmId = 0);
+
+ /**
+ * @name GrantRole
+ * @brief Grants a permission
+ *
+ * Grants a permission to the account. If realm is 0 or the permission can not be added
+ * No save to db action will be performed.
+ *
+ * Fails if permission Id does not exists or permission already granted or denied
+ *
+ * @param permissionId permission to be granted
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to grant the permission
+ *
+ * Example Usage:
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 permissionId = 2;
+ * if (rbac->GrantRole(permissionId) == RBAC_IN_DENIED_LIST)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Failed to grant permission %u, already denied", permissionId);
+ * @endcode
+ */
+ RBACCommandResult GrantPermission(uint32 permissionId, int32 realmId = 0);
+
+ /**
+ * @name DenyPermission
+ * @brief Denies a permission
+ *
+ * Denied a permission to the account. If realm is 0 or the permission can not be added
+ * No save to db action will be performed.
+ *
+ * Fails if permission Id does not exists or permission already granted or denied
+ *
+ * @param permissionId permission to be denied
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to deny the permission
+ *
+ * Example Usage:
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 permissionId = 2;
+ * if (rbac->DenyRole(permissionId) == RBAC_ID_DOES_NOT_EXISTS)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Role Id %u does not exists", permissionId);
+ * @endcode
+ */
+ RBACCommandResult DenyPermission(uint32 permissionId, int32 realmId = 0);
+
+ /**
+ * @name RevokePermission
+ * @brief Removes a permission
+ *
+ * Removes a permission from the account. If realm is 0 or the permission can not be removed
+ * No save to db action will be performed. Any delete operation will always affect
+ * "all realms (-1)" in addition to the realm specified
+ *
+ * Fails if permission not present
+ *
+ * @param permissionId permission to be removed
+ * @param realmId realm affected
+ *
+ * @return Success or failure (with reason) to remove the permission
+ *
+ * Example Usage:
+ * // previously defined "RBACData* rbac" with proper initialization
+ * uint32 permissionId = 2;
+ * if (rbac->RevokeRole(permissionId) == RBAC_OK)
+ * sLog->outDebug(LOG_FILTER_PLAYER, "Permission %u succesfully removed", permissionId);
+ * @endcode
+ */
+ RBACCommandResult RevokePermission(uint32 permissionId, int32 realmId = 0);
+
+ /// Loads all permissions, groups and roles assigned to current account
+ void LoadFromDB();
+ private:
+ /// Saves a role to DB, Granted or Denied
+ void SaveRole(uint32 role, bool granted, int32 realm);
+ /// Saves a permission to DB, Granted or Denied
+ void SavePermission(uint32 role, bool granted, int32 realm);
+
+ /**
+ * @name CalculateNewPermissions
+ * @brief Calculates new permissions
+ *
+ * Calculates new permissions after some change in groups, roles or permissions.
+ * The calculation is done Granted - Denied:
+ * - Granted permissions: through groups, through roles and directly assigned
+ * - Denied permissions: through roles and directly assigned
+ */
+ void CalculateNewPermissions();
+
+ int32 GetRealmId() { return _realmId; }
+
+ int32 _realmId; ///> RealmId Affected
+ RBACGroupContainer _groups; ///> Granted groups
+ RBACRoleContainer _grantedRoles; ///> Granted roles
+ RBACRoleContainer _deniedRoles; ///> Denied roles
+ RBACPermissionContainer _grantedPerms; ///> Granted permissions
+ RBACPermissionContainer _deniedPerms; ///> Denied permissions
+ RBACPermissionContainer _globalPerms; ///> Calculated permissions
+};
+
+#endif
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 2fd55ac29ef..1de9c785ed2 100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -2209,6 +2209,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
return;
}
+ uint32 loaded = 0;
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(entryId);
@@ -2220,9 +2221,11 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if (criteria->timeLimit)
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
+
+ ++loaded;
}
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement criteria in %u ms", loaded, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
@@ -2284,14 +2287,14 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
}
uint32 dataType = fields[1].GetUInt8();
- const char* scriptName = fields[4].GetCString();
+ std::string scriptName = fields[4].GetString();
uint32 scriptId = 0;
- if (strcmp(scriptName, "")) // not empty
+ if (scriptName.length()) // not empty
{
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
else
- scriptId = sObjectMgr->GetScriptId(scriptName);
+ scriptId = sObjectMgr->GetScriptId(scriptName.c_str());
}
AchievementCriteriaData data(dataType, fields[2].GetUInt32(), fields[3].GetUInt32(), scriptId);
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 71c44408f72..586a42c9f7e 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -93,46 +93,45 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (!pItem)
return;
- uint32 bidder_accId = 0;
- uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
- Player* bidder = ObjectAccessor::FindPlayer(bidder_guid);
+ uint32 bidderAccId = 0;
+ uint64 bidderGuid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
+ Player* bidder = ObjectAccessor::FindPlayer(bidderGuid);
// data for gm.log
if (sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
- uint32 bidder_security = 0;
- std::string bidder_name;
+ std::string bidderName;
+ bool logGmTrade = false;
+
if (bidder)
{
- bidder_accId = bidder->GetSession()->GetAccountId();
- bidder_security = bidder->GetSession()->GetSecurity();
- bidder_name = bidder->GetName();
+ bidderAccId = bidder->GetSession()->GetAccountId();
+ bidderName = bidder->GetName();
+ logGmTrade = bidder->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE);
}
else
{
- bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid);
- bidder_security = AccountMgr::GetSecurity(bidder_accId, realmID);
+ bidderAccId = sObjectMgr->GetPlayerAccountIdByGUID(bidderGuid);
+ logGmTrade = AccountMgr::HasPermission(bidderAccId, RBAC_PERM_LOG_GM_TRADE, realmID);
- if (!AccountMgr::IsPlayerAccount(bidder_security)) // not do redundant DB requests
- {
- if (!sObjectMgr->GetPlayerNameByGUID(bidder_guid, bidder_name))
- bidder_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
- }
+ if (logGmTrade && !sObjectMgr->GetPlayerNameByGUID(bidderGuid, bidderName))
+ bidderName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
}
- if (!AccountMgr::IsPlayerAccount(bidder_security))
+
+ if (logGmTrade)
{
- std::string owner_name;
- if (!sObjectMgr->GetPlayerNameByGUID(auction->owner, owner_name))
- owner_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
+ std::string ownerName;
+ if (!sObjectMgr->GetPlayerNameByGUID(auction->owner, ownerName))
+ ownerName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
- uint32 owner_accid = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner);
+ uint32 ownerAccId = sObjectMgr->GetPlayerAccountIdByGUID(auction->owner);
- sLog->outCommand(bidder_accId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
- bidder_name.c_str(), bidder_accId, pItem->GetTemplate()->Name1.c_str(), pItem->GetEntry(), pItem->GetCount(), auction->bid, owner_name.c_str(), owner_accid);
+ sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
+ bidderName.c_str(), bidderAccId, pItem->GetTemplate()->Name1.c_str(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
}
}
// receiver exist
- if (bidder || bidder_accId)
+ if (bidder || bidderAccId)
{
// set owner to bidder (to prevent delete item with sender char deleting)
// owner in `data` will set at mail receive and item extracting
@@ -143,7 +142,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (bidder)
{
- bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->itemEntry);
+ bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidderGuid, 0, 0, auction->itemEntry);
// FIXME: for offline player need also
bidder->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
}
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index dffdb2361d5..5b3284b2098 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -161,16 +161,17 @@ bool Battlefield::Update(uint32 diff)
// Kick players who chose not to accept invitation to the battle
if (m_uiKickDontAcceptTimer <= diff)
{
+ time_t now = time(NULL);
for (int team = 0; team < 2; team++)
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
- if ((*itr).second <= time(NULL))
- KickPlayerFromBattlefield((*itr).first);
+ if (itr->second <= now)
+ KickPlayerFromBattlefield(itr->first);
InvitePlayersInZoneToWar();
for (int team = 0; team < 2; team++)
for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); ++itr)
- if ((*itr).second <= time(NULL))
- KickPlayerFromBattlefield((*itr).first);
+ if (itr->second <= now)
+ KickPlayerFromBattlefield(itr->first);
m_uiKickDontAcceptTimer = 1000;
}
@@ -816,7 +817,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team)
{
//Get map object
- Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(m_MapId));
+ Map* map = sMapMgr->CreateBaseMap(m_MapId);
if (!map)
{
sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
@@ -854,7 +855,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
{
// Get map object
- Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(571)); // *vomits*
+ Map* map = sMapMgr->CreateBaseMap(571); // *vomits*
if (!map)
return 0;
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index 7a8d856aa8e..534bfd620f0 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -71,7 +71,7 @@ class BfGraveyard;
typedef std::set<uint64> GuidSet;
typedef std::vector<BfGraveyard*> GraveyardVect;
-typedef std::map<uint64, uint32> PlayerTimerMap;
+typedef std::map<uint64, time_t> PlayerTimerMap;
class BfCapturePoint
{
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 24e69a151b5..6133bd60258 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -589,6 +589,27 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original
bg->SetRated(isRated);
bg->SetRandom(isRandom);
+ // Set up correct min/max player counts for scoreboards
+ if (bg->isArena())
+ {
+ uint32 maxPlayersPerTeam = 0;
+ switch (arenaType)
+ {
+ case ARENA_TYPE_2v2:
+ maxPlayersPerTeam = 2;
+ break;
+ case ARENA_TYPE_3v3:
+ maxPlayersPerTeam = 3;
+ break;
+ case ARENA_TYPE_5v5:
+ maxPlayersPerTeam = 5;
+ break;
+ }
+
+ bg->SetMaxPlayersPerTeam(maxPlayersPerTeam);
+ bg->SetMaxPlayers(maxPlayersPerTeam * 2);
+ }
+
return bg;
}
@@ -649,8 +670,8 @@ bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
bg->SetArenaorBGType(data.IsArena);
bg->SetMinPlayersPerTeam(data.MinPlayersPerTeam);
bg->SetMaxPlayersPerTeam(data.MaxPlayersPerTeam);
- bg->SetMinPlayers(data.MinPlayersPerTeam* 2);
- bg->SetMaxPlayers(data.MaxPlayersPerTeam* 2);
+ bg->SetMinPlayers(data.MinPlayersPerTeam * 2);
+ bg->SetMaxPlayers(data.MaxPlayersPerTeam * 2);
bg->SetName(data.BattlegroundName);
bg->SetTeamStartLoc(ALLIANCE, data.Team1StartLocX, data.Team1StartLocY, data.Team1StartLocZ, data.Team1StartLocO);
bg->SetTeamStartLoc(HORDE, data.Team2StartLocX, data.Team2StartLocY, data.Team2StartLocZ, data.Team2StartLocO);
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index 763e0132c10..5f73ee48380 100644
--- a/src/server/game/Calendar/CalendarMgr.cpp
+++ b/src/server/game/Calendar/CalendarMgr.cpp
@@ -40,6 +40,12 @@ CalendarMgr::CalendarMgr()
CalendarMgr::~CalendarMgr()
{
+ for (CalendarEventStore::iterator itr = _events.begin(); itr != _events.end(); ++itr)
+ delete *itr;
+
+ for (CalendarEventInviteStore::iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
+ for (CalendarInviteStore::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
+ delete *itr2;
}
void CalendarMgr::LoadFromDB()
@@ -153,7 +159,7 @@ void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
PreparedStatement* stmt;
MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody());
- std::vector<CalendarInvite*>::iterator itr = _invites[eventId].begin();
+ CalendarInviteStore::iterator itr = _invites[eventId].begin();
while (itr != _invites[eventId].end())
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
@@ -187,7 +193,7 @@ void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover
if (!calendarEvent)
return;
- std::vector<CalendarInvite*>::iterator itr = _invites[eventId].begin();
+ CalendarInviteStore::iterator itr = _invites[eventId].begin();
for (; itr != _invites[eventId].end(); ++itr)
if ((*itr)->GetInviteId() == inviteId)
break;
@@ -254,8 +260,8 @@ void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
if ((*itr)->GetCreatorGUID() == guid)
RemoveEvent((*itr)->GetEventId(), 0); // don't send mail if removing a character
- std::vector<CalendarInvite*> playerInvites = GetPlayerInvites(guid);
- for (std::vector<CalendarInvite*>::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
+ CalendarInviteStore playerInvites = GetPlayerInvites(guid);
+ for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
}
@@ -265,14 +271,14 @@ void CalendarMgr::RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId)
if ((*itr)->GetCreatorGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement()))
RemoveEvent((*itr)->GetEventId(), guid);
- std::vector<CalendarInvite*> playerInvites = GetPlayerInvites(guid);
- for (std::vector<CalendarInvite*>::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
+ CalendarInviteStore playerInvites = GetPlayerInvites(guid);
+ for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
if (CalendarEvent* calendarEvent = GetEvent((*itr)->GetEventId()))
if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == guildId)
RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
}
-CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
+CalendarEvent* CalendarMgr::GetEvent(uint64 eventId) const
{
for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
if ((*itr)->GetEventId() == eventId)
@@ -282,10 +288,10 @@ CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
return NULL;
}
-CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
+CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) const
{
- for (CalendarInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
- for (std::vector<CalendarInvite*>::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
+ for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
+ for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
if ((*itr2)->GetInviteId() == inviteId)
return *itr2;
@@ -305,12 +311,10 @@ uint64 CalendarMgr::GetFreeEventId()
{
if (_freeEventIds.empty())
return ++_maxEventId;
- else
- {
- uint64 eventId = _freeEventIds.front();
- _freeEventIds.pop_front();
- return eventId;
- }
+
+ uint64 eventId = _freeEventIds.front();
+ _freeEventIds.pop_front();
+ return eventId;
}
void CalendarMgr::FreeInviteId(uint64 id)
@@ -325,20 +329,18 @@ uint64 CalendarMgr::GetFreeInviteId()
{
if (_freeInviteIds.empty())
return ++_maxInviteId;
- else
- {
- uint64 inviteId = _freeInviteIds.front();
- _freeInviteIds.pop_front();
- return inviteId;
- }
+
+ uint64 inviteId = _freeInviteIds.front();
+ _freeInviteIds.pop_front();
+ return inviteId;
}
CalendarEventStore CalendarMgr::GetPlayerEvents(uint64 guid)
{
CalendarEventStore events;
- for (CalendarInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
- for (std::vector<CalendarInvite*>::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
+ for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
+ for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
if ((*itr2)->GetInviteeGUID() == guid)
events.insert(GetEvent(itr->first));
@@ -350,17 +352,17 @@ CalendarEventStore CalendarMgr::GetPlayerEvents(uint64 guid)
return events;
}
-std::vector<CalendarInvite*> CalendarMgr::GetEventInvites(uint64 eventId)
+CalendarInviteStore const& CalendarMgr::GetEventInvites(uint64 eventId)
{
return _invites[eventId];
}
-std::vector<CalendarInvite*> CalendarMgr::GetPlayerInvites(uint64 guid)
+CalendarInviteStore CalendarMgr::GetPlayerInvites(uint64 guid)
{
- std::vector<CalendarInvite*> invites;
+ CalendarInviteStore invites;
- for (CalendarInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
- for (std::vector<CalendarInvite*>::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
+ for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
+ for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
if ((*itr2)->GetInviteeGUID() == guid)
invites.push_back(*itr2);
@@ -369,13 +371,22 @@ std::vector<CalendarInvite*> CalendarMgr::GetPlayerInvites(uint64 guid)
uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
{
- std::vector<CalendarInvite*> const& invites = GetPlayerInvites(guid);
+ CalendarInviteStore const& invites = GetPlayerInvites(guid);
uint32 pendingNum = 0;
- for (std::vector<CalendarInvite*>::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
- // correct?
- if ((*itr)->GetStatus() == CALENDAR_STATUS_INVITED || (*itr)->GetStatus() == CALENDAR_STATUS_TENTATIVE || (*itr)->GetStatus() == CALENDAR_STATUS_NOT_SIGNED_UP)
- ++pendingNum;
+ for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
+ {
+ switch ((*itr)->GetStatus())
+ {
+ case CALENDAR_STATUS_INVITED:
+ case CALENDAR_STATUS_TENTATIVE:
+ case CALENDAR_STATUS_NOT_SIGNED_UP:
+ ++pendingNum;
+ break;
+ default:
+ break;
+ }
+ }
return pendingNum;
}
@@ -531,7 +542,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
if (!player)
return;
- std::vector<CalendarInvite*> const& eventInviteeList = _invites[calendarEvent.GetEventId()];
+ CalendarInviteStore const& eventInviteeList = _invites[calendarEvent.GetEventId()];
WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
data << uint8(sendType);
@@ -549,7 +560,7 @@ void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEv
data << uint32(calendarEvent.GetGuildId());
data << uint32(eventInviteeList.size());
- for (std::vector<CalendarInvite*>::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
+ for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
{
CalendarInvite const* calendarInvite = (*itr);
uint64 inviteeGuid = calendarInvite->GetInviteeGUID();
@@ -627,8 +638,8 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven
guild->BroadcastPacket(&packet);
// Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them)
- std::vector<CalendarInvite*> invites = _invites[calendarEvent.GetEventId()];
- for (std::vector<CalendarInvite*>::iterator itr = invites.begin(); itr != invites.end(); ++itr)
+ CalendarInviteStore invites = _invites[calendarEvent.GetEventId()];
+ for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer((*itr)->GetInviteeGUID()))
if (!calendarEvent.IsGuildEvent() || (calendarEvent.IsGuildEvent() && player->GetGuildId() != calendarEvent.GetGuildId()))
player->SendDirectMessage(&packet);
diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h
index 3674e707399..d1b3d0a9dd6 100644
--- a/src/server/game/Calendar/CalendarMgr.h
+++ b/src/server/game/Calendar/CalendarMgr.h
@@ -261,9 +261,9 @@ struct CalendarEvent
std::string _title;
std::string _description;
};
-
+typedef std::vector<CalendarInvite*> CalendarInviteStore;
typedef std::set<CalendarEvent*> CalendarEventStore;
-typedef std::map<uint64 /* eventId */, std::vector<CalendarInvite*> > CalendarInviteStore;
+typedef std::map<uint64 /* eventId */, CalendarInviteStore > CalendarEventInviteStore;
class CalendarMgr
{
@@ -274,7 +274,7 @@ class CalendarMgr
~CalendarMgr();
CalendarEventStore _events;
- CalendarInviteStore _invites;
+ CalendarEventInviteStore _invites;
std::deque<uint64> _freeEventIds;
std::deque<uint64> _freeInviteIds;
@@ -284,14 +284,14 @@ class CalendarMgr
public:
void LoadFromDB();
- CalendarEvent* GetEvent(uint64 eventId);
+ CalendarEvent* GetEvent(uint64 eventId) const;
CalendarEventStore const& GetEvents() const { return _events; }
CalendarEventStore GetPlayerEvents(uint64 guid);
- CalendarInvite* GetInvite(uint64 inviteId);
- CalendarInviteStore const& GetInvites() const { return _invites; }
- std::vector<CalendarInvite*> GetEventInvites(uint64 eventId);
- std::vector<CalendarInvite*> GetPlayerInvites(uint64 guid);
+ CalendarInvite* GetInvite(uint64 inviteId) const;
+ CalendarEventInviteStore const& GetInvites() const { return _invites; }
+ CalendarInviteStore const& GetEventInvites(uint64 eventId);
+ CalendarInviteStore GetPlayerInvites(uint64 guid);
void FreeEventId(uint64 id);
uint64 GetFreeEventId();
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index 9e7a63c9093..5f6bc8b7865 100644
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -180,7 +180,7 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
- AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) &&
+ AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && //FIXME: Move to RBAC
player->GetGroup())
{
WorldPacket data;
@@ -191,8 +191,8 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
player->JoinedChannel(this);
- if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
- !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+ if (_announce && (!sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ||
+ !player->GetSession()->HasPermission(RBAC_PERM_SILENTLY_JOIN_CHANNEL)))
{
WorldPacket data;
MakeJoined(&data, guid);
@@ -252,8 +252,9 @@ void Channel::LeaveChannel(Player* player, bool send)
bool changeowner = playersStore[guid].IsOwner();
playersStore.erase(guid);
- if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
- !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+
+ if (_announce && (!sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ||
+ !player->GetSession()->HasPermission(RBAC_PERM_SILENTLY_JOIN_CHANNEL)))
{
WorldPacket data;
MakeLeft(&data, guid);
@@ -279,7 +280,6 @@ void Channel::LeaveChannel(Player* player, bool send)
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
- AccountTypes sec = player->GetSession()->GetSecurity();
uint64 good = player->GetGUID();
if (!IsOn(good))
@@ -290,7 +290,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
return;
}
- if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
+ if (!playersStore[good].IsModerator() && !player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
WorldPacket data;
MakeNotModerator(&data);
@@ -310,7 +310,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
bool changeowner = _ownerGUID == victim;
- if (!AccountMgr::IsGMAccount(sec) && changeowner && good != _ownerGUID)
+ if (!player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && changeowner && good != _ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -318,7 +318,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
return;
}
- bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
+ bool notify = !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) || !player->GetSession()->HasPermission(RBAC_PERM_SILENTLY_JOIN_CHANNEL);
if (ban && !IsBanned(victim))
{
@@ -363,7 +363,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
return;
}
- if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
+ if (!playersStore[good].IsModerator() && !player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
WorldPacket data;
MakeNotModerator(&data);
@@ -404,7 +404,7 @@ void Channel::Password(Player const* player, std::string const& pass)
return;
}
- if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()))
+ if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
WorldPacket data;
MakeNotModerator(&data);
@@ -424,7 +424,6 @@ void Channel::Password(Player const* player, std::string const& pass)
void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
uint64 guid = player->GetGUID();
- uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(guid))
{
@@ -434,7 +433,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
return;
}
- if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
+ if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
WorldPacket data;
MakeNotModerator(&data);
@@ -449,10 +448,11 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
uint64 victim = newp ? newp->GetGUID() : 0;
if (!victim || !IsOn(victim) ||
+ (player->GetTeam() != newp->GetTeam() && (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) ||
+ !player->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
+ !newp->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL))))
// 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->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -477,7 +477,6 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
void Channel::SetOwner(Player const* player, std::string const& newname)
{
uint64 guid = player->GetGUID();
- uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(guid))
{
@@ -487,7 +486,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
return;
}
- if (!AccountMgr::IsGMAccount(sec) && guid != _ownerGUID)
+ if (!player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR) && guid != _ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -553,7 +552,9 @@ void Channel::List(Player const* player)
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
- if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
+ if (member &&
+ (player->GetSession()->HasPermission(RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS) ||
+ member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
member->IsVisibleGloballyFor(player))
{
data << uint64(i->first);
@@ -570,7 +571,6 @@ void Channel::List(Player const* player)
void Channel::Announce(Player const* player)
{
uint64 guid = player->GetGUID();
- uint32 sec = player->GetSession()->GetSecurity();
if (!IsOn(guid))
{
@@ -580,7 +580,7 @@ void Channel::Announce(Player const* player)
return;
}
- if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
+ if (!playersStore[guid].IsModerator() && !player->GetSession()->HasPermission(RBAC_PERM_CHANGE_CHANNEL_NOT_MODERATOR))
{
WorldPacket data;
MakeNotModerator(&data);
@@ -605,6 +605,11 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
if (what.empty())
return;
+ uint8 chatTag = 0;
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ chatTag = player->GetChatTag();
+
+ // TODO: Add proper RBAC check
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
@@ -633,8 +638,7 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
data << uint64(guid);
data << uint32(what.size() + 1);
data << what;
- Player* player = ObjectAccessor::FindPlayer(guid);
- data << uint8(player ? player->GetChatTag() : 0);
+ data << uint8(chatTag);
SendToAll(&data, !playersStore[guid].IsModerator() ? guid : false);
}
@@ -668,7 +672,9 @@ void Channel::Invite(Player const* player, std::string const& newname)
return;
}
- if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ if (newp->GetTeam() != player->GetTeam() && (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) ||
+ !player->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
+ !newp->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL)))
{
WorldPacket data;
MakeInviteWrongFaction(&data);
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index 0b3b84088a5..295c8d5394d 100644
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -49,8 +49,8 @@ enum ChatNotify
CHAT_MODE_CHANGE_NOTICE = 0x0C, //?
CHAT_ANNOUNCEMENTS_ON_NOTICE = 0x0D, //+ "[%s] Channel announcements enabled by %s.";
CHAT_ANNOUNCEMENTS_OFF_NOTICE = 0x0E, //+ "[%s] Channel announcements disabled by %s.";
- // CHAT_MODERATION_ON_NOTICE = 0x0F, //+ "[%s] Channel moderation enabled by %s.";
- // CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s.";
+ CHAT_MODERATION_ON_NOTICE = 0x0F, //+ "[%s] Channel moderation enabled by %s.";
+ CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s.";
CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak.";
CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s.";
CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are bannedStore from that channel.";
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 0bf7c8591e3..7c92af2d67f 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -122,8 +122,28 @@ const char *ChatHandler::GetTrinityString(int32 entry) const
bool ChatHandler::isAvailable(ChatCommand const& cmd) const
{
- // check security level only for simple command (without child commands)
- return m_session->GetSecurity() >= AccountTypes(cmd.SecurityLevel);
+ uint32 permission = 0;
+
+ ///@Workaround:: Fast adaptation to RBAC system till all commands are moved to permissions
+ switch (AccountTypes(cmd.SecurityLevel))
+ {
+ case SEC_ADMINISTRATOR:
+ permission = RBAC_PERM_ADMINISTRATOR_COMMANDS;
+ break;
+ case SEC_GAMEMASTER:
+ permission = RBAC_PERM_GAMEMASTER_COMMANDS;
+ break;
+ case SEC_MODERATOR:
+ permission = RBAC_PERM_MODERATOR_COMMANDS;
+ break;
+ case SEC_PLAYER:
+ permission = RBAC_PERM_PLAYER_COMMANDS;
+ break;
+ default: // Allow custom security levels for commands
+ return m_session->GetSecurity() >= AccountTypes(cmd.SecurityLevel);
+ }
+
+ return m_session->HasPermission(permission);
}
bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
@@ -155,7 +175,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
return false;
// ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
- if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY))
+ if (m_session->HasPermission(RBAC_PERM_CHECK_FOR_LOWER_SECURITY) && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY))
return false;
if (target)
@@ -341,6 +361,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, co
// table[i].Name == "" is special case: send original command to handler
if ((table[i].Handler)(this, table[i].Name[0] != '\0' ? text : oldtext))
{
+ // FIXME: When Command system is moved to RBAC this check must be changed
if (!AccountMgr::IsPlayerAccount(table[i].SecurityLevel))
{
// chat case
@@ -431,7 +452,7 @@ bool ChatHandler::ParseCommands(char const* text)
std::string fullcmd = text;
- if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS))
+ if (m_session && !m_session->HasPermission(RBAC_PERM_PLAYER_COMMANDS))
return false;
/// chat case (.command or !command format)
@@ -456,7 +477,7 @@ bool ChatHandler::ParseCommands(char const* text)
if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
{
- if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
+ if (m_session && !m_session->HasPermission(RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR))
return false;
SendSysMessage(LANG_NO_CMD);
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 5e1a05669ed..96cb8b7ee25 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -431,6 +431,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
default:
break;
}
+ break;
case CONDITION_TYPE_MASK:
if (ConditionValue1 & TYPEMASK_UNIT)
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
@@ -777,7 +778,7 @@ void ConditionMgr::LoadConditions(bool isReload)
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions. DB table `conditions` is empty!");
return;
}
diff --git a/src/server/game/DungeonFinding/LFG.cpp b/src/server/game/DungeonFinding/LFG.cpp
new file mode 100644
index 00000000000..ce16ad5533e
--- /dev/null
+++ b/src/server/game/DungeonFinding/LFG.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "LFG.h"
+#include "Language.h"
+#include "ObjectMgr.h"
+
+namespace lfg
+{
+
+std::string ConcatenateDungeons(LfgDungeonSet const& dungeons)
+{
+ std::string dungeonstr = "";
+ if (!dungeons.empty())
+ {
+ std::ostringstream o;
+ LfgDungeonSet::const_iterator it = dungeons.begin();
+ o << (*it);
+ for (++it; it != dungeons.end(); ++it)
+ o << ", " << uint32(*it);
+ dungeonstr = o.str();
+ }
+ return dungeonstr;
+}
+
+std::string GetRolesString(uint8 roles)
+{
+ std::string rolesstr = "";
+
+ if (roles & PLAYER_ROLE_TANK)
+ rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_TANK));
+
+ if (roles & PLAYER_ROLE_HEALER)
+ {
+ if (!rolesstr.empty())
+ rolesstr.append(", ");
+ rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_HEALER));
+ }
+
+ if (roles & PLAYER_ROLE_DAMAGE)
+ {
+ if (!rolesstr.empty())
+ rolesstr.append(", ");
+ rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_DAMAGE));
+ }
+
+ if (roles & PLAYER_ROLE_LEADER)
+ {
+ if (!rolesstr.empty())
+ rolesstr.append(", ");
+ rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_LEADER));
+ }
+
+ if (rolesstr.empty())
+ rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_NONE));
+
+ return rolesstr;
+}
+
+std::string GetStateString(LfgState state)
+{
+ int32 entry = LANG_LFG_ERROR;
+ switch (state)
+ {
+ case LFG_STATE_NONE:
+ entry = LANG_LFG_STATE_NONE;
+ break;
+ case LFG_STATE_ROLECHECK:
+ entry = LANG_LFG_STATE_ROLECHECK;
+ break;
+ case LFG_STATE_QUEUED:
+ entry = LANG_LFG_STATE_QUEUED;
+ break;
+ case LFG_STATE_PROPOSAL:
+ entry = LANG_LFG_STATE_PROPOSAL;
+ break;
+ case LFG_STATE_DUNGEON:
+ entry = LANG_LFG_STATE_DUNGEON;
+ break;
+ case LFG_STATE_BOOT:
+ entry = LANG_LFG_STATE_BOOT;
+ break;
+ case LFG_STATE_FINISHED_DUNGEON:
+ entry = LANG_LFG_STATE_FINISHED_DUNGEON;
+ break;
+ case LFG_STATE_RAIDBROWSER:
+ entry = LANG_LFG_STATE_RAIDBROWSER;
+ break;
+ }
+
+ return std::string(sObjectMgr->GetTrinityStringForDBCLocale(entry));
+}
+
+} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h
index ebbcfb1d71a..541e4d6bd43 100644
--- a/src/server/game/DungeonFinding/LFG.h
+++ b/src/server/game/DungeonFinding/LFG.h
@@ -20,6 +20,9 @@
#include "Common.h"
+namespace lfg
+{
+
enum LFGEnum
{
LFG_TANKS_NEEDED = 1,
@@ -99,4 +102,10 @@ typedef std::list<uint64> LfgGuidList;
typedef std::map<uint64, uint8> LfgRolesMap;
typedef std::map<uint64, uint64> LfgGroupsMap;
+std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
+std::string GetRolesString(uint8 roles);
+std::string GetStateString(LfgState state);
+
+} // namespace lfg
+
#endif
diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp
index 427225bf323..f711514e26d 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.cpp
+++ b/src/server/game/DungeonFinding/LFGGroupData.cpp
@@ -18,6 +18,9 @@
#include "LFG.h"
#include "LFGGroupData.h"
+namespace lfg
+{
+
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
{ }
@@ -122,3 +125,5 @@ uint8 LfgGroupData::GetKicksLeft() const
{
return m_KicksLeft;
}
+
+} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGGroupData.h b/src/server/game/DungeonFinding/LFGGroupData.h
index 2ad020d3bc1..47e562c37aa 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.h
+++ b/src/server/game/DungeonFinding/LFGGroupData.h
@@ -20,6 +20,9 @@
#include "LFG.h"
+namespace lfg
+{
+
enum LfgGroupEnum
{
LFG_GROUP_MAX_KICKS = 3,
@@ -75,4 +78,6 @@ class LfgGroupData
uint8 m_KicksLeft; ///< Number of kicks left
};
+} // namespace lfg
+
#endif
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index a931d61f740..ce18c227656 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -29,10 +29,14 @@
#include "LFGQueue.h"
#include "Group.h"
#include "Player.h"
+#include "RBAC.h"
#include "GroupMgr.h"
#include "GameEventMgr.h"
#include "WorldSession.h"
+namespace lfg
+{
+
LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1),
m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK))
{
@@ -95,89 +99,6 @@ void LFGMgr::_SaveToDB(uint64 guid, uint32 db_guid)
CharacterDatabase.Execute(stmt);
}
-std::string LFGMgr::ConcatenateDungeons(LfgDungeonSet const& dungeons)
-{
- std::string dungeonstr = "";
- if (!dungeons.empty())
- {
- std::ostringstream o;
- LfgDungeonSet::const_iterator it = dungeons.begin();
- o << (*it);
- for (++it; it != dungeons.end(); ++it)
- o << ", " << uint32(*it);
- dungeonstr = o.str();
- }
- return dungeonstr;
-}
-
-std::string LFGMgr::GetRolesString(uint8 roles)
-{
- std::string rolesstr = "";
-
- if (roles & PLAYER_ROLE_TANK)
- rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_TANK));
-
- if (roles & PLAYER_ROLE_HEALER)
- {
- if (!rolesstr.empty())
- rolesstr.append(", ");
- rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_HEALER));
- }
-
- if (roles & PLAYER_ROLE_DAMAGE)
- {
- if (!rolesstr.empty())
- rolesstr.append(", ");
- rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_DAMAGE));
- }
-
- if (roles & PLAYER_ROLE_LEADER)
- {
- if (!rolesstr.empty())
- rolesstr.append(", ");
- rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_LEADER));
- }
-
- if (rolesstr.empty())
- rolesstr.append(sObjectMgr->GetTrinityStringForDBCLocale(LANG_LFG_ROLE_NONE));
-
- return rolesstr;
-}
-
-std::string LFGMgr::GetStateString(LfgState state)
-{
- int32 entry = LANG_LFG_ERROR;
- switch (state)
- {
- case LFG_STATE_NONE:
- entry = LANG_LFG_STATE_NONE;
- break;
- case LFG_STATE_ROLECHECK:
- entry = LANG_LFG_STATE_ROLECHECK;
- break;
- case LFG_STATE_QUEUED:
- entry = LANG_LFG_STATE_QUEUED;
- break;
- case LFG_STATE_PROPOSAL:
- entry = LANG_LFG_STATE_PROPOSAL;
- break;
- case LFG_STATE_DUNGEON:
- entry = LANG_LFG_STATE_DUNGEON;
- break;
- case LFG_STATE_BOOT:
- entry = LANG_LFG_STATE_BOOT;
- break;
- case LFG_STATE_FINISHED_DUNGEON:
- entry = LANG_LFG_STATE_FINISHED_DUNGEON;
- break;
- case LFG_STATE_RAIDBROWSER:
- entry = LANG_LFG_STATE_RAIDBROWSER;
- break;
- }
-
- return std::string(sObjectMgr->GetTrinityStringForDBCLocale(entry));
-}
-
/// Load rewards for completing dungeons
void LFGMgr::LoadRewards()
{
@@ -207,7 +128,7 @@ void LFGMgr::LoadRewards()
uint32 firstQuestId = fields[2].GetUInt32();
uint32 otherQuestId = fields[3].GetUInt32();
- if (!GetLFGDungeon(dungeonId))
+ if (!GetLFGDungeonEntry(dungeonId))
{
sLog->outError(LOG_FILTER_SQL, "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
continue;
@@ -248,11 +169,6 @@ LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id)
return NULL;
}
-LFGDungeonContainer & LFGMgr::GetLFGDungeonMap()
-{
- return LfgDungeonStore;
-}
-
void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
{
uint32 oldMSTime = getMSTime();
@@ -282,7 +198,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!");
return;
}
@@ -464,6 +380,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
uint8 expansion = player->GetSession()->Expansion();
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
LfgLockMap lock;
+ bool denyJoin = !player->GetSession()->HasPermission(RBAC_PERM_JOIN_DUNGEON_FINDER);
for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
@@ -472,7 +389,9 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
continue;
uint32 lockData = 0;
- if (dungeon->expansion > expansion)
+ if (denyJoin)
+ lockData = LFG_LOCKSTATUS_RAID_LOCKED;
+ else if (dungeon->expansion > expansion)
lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
@@ -554,7 +473,9 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
}
// Check player or group member restrictions
- if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue())
+ if (!player->GetSession()->HasPermission(RBAC_PERM_JOIN_DUNGEON_FINDER))
+ joinData.result = LFG_JOIN_NOT_MEET_REQS;
+ else 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;
@@ -573,6 +494,8 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
{
if (Player* plrg = itr->getSource())
{
+ if (!plrg->GetSession()->HasPermission(RBAC_PERM_JOIN_DUNGEON_FINDER))
+ joinData.result = LFG_JOIN_PARTY_NOT_MEET_REQS;
if (plrg->HasAura(LFG_SPELL_DUNGEON_DESERTER))
joinData.result = LFG_JOIN_PARTY_DESERTER;
else if (plrg->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
@@ -1163,7 +1086,6 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
break;
}
- teleportStore.push_back(pguid);
SetState(pguid, LFG_STATE_DUNGEON);
}
@@ -1398,10 +1320,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported out. Current Map %u - Expected Map %u",
player->GetName().c_str(), player->GetMapId(), uint32(dungeon->map));
if (player->GetMapId() == uint32(dungeon->map))
- {
- player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
player->TeleportToBGEntryPoint();
- }
return;
}
@@ -1675,16 +1594,6 @@ const std::string& LFGMgr::GetComment(uint64 guid)
return PlayersStore[guid].GetComment();
}
-bool LFGMgr::IsTeleported(uint64 pguid)
-{
- if (std::find(teleportStore.begin(), teleportStore.end(), pguid) != teleportStore.end())
- {
- teleportStore.remove(pguid);
- return true;
- }
- return false;
-}
-
LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid)
{
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
@@ -2039,3 +1948,56 @@ void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid)
SetGroup(guid, gguid);
AddPlayerToGroup(gguid, guid);
}
+
+bool LFGMgr::selectedRandomLfgDungeon(uint64 guid)
+{
+ if (GetState(guid) != LFG_STATE_NONE)
+ {
+ LfgDungeonSet const& dungeons = GetSelectedDungeons(guid);
+ if (!dungeons.empty())
+ {
+ LFGDungeonData const* dungeon = GetLFGDungeon(*dungeons.begin());
+ if (dungeon && (dungeon->type == LFG_TYPE_RANDOM || dungeon->seasonal))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty)
+{
+ if (!IS_GROUP_GUID(guid))
+ guid = GetGroup(guid);
+
+ if (uint32 dungeonId = GetDungeon(guid, true))
+ if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
+ if (uint32(dungeon->map) == map && dungeon->difficulty == difficulty)
+ return true;
+
+ return false;
+}
+
+uint32 LFGMgr::GetLFGDungeonEntry(uint32 id)
+{
+ if (id)
+ if (LFGDungeonData const* dungeon = GetLFGDungeon(id))
+ return dungeon->Entry();
+
+ return 0;
+}
+
+LfgDungeonSet LFGMgr::GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion)
+{
+ LfgDungeonSet randomDungeons;
+ for (lfg::LFGDungeonContainer::const_iterator itr = LfgDungeonStore.begin(); itr != LfgDungeonStore.end(); ++itr)
+ {
+ lfg::LFGDungeonData const& dungeon = itr->second;
+ if ((dungeon.type == lfg::LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id)))
+ && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel)
+ randomDungeons.insert(dungeon.Entry());
+ }
+ return randomDungeons;
+}
+
+} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 74c7ca9e3d3..96fedb65547 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -30,6 +30,9 @@ class Group;
class Player;
class Quest;
+namespace lfg
+{
+
enum LfgOptions
{
LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01,
@@ -296,91 +299,123 @@ class LFGMgr
~LFGMgr();
public:
+ // Functions used outside lfg namespace
void Update(uint32 diff);
- // Reward
- void LoadRewards();
+ // World.cpp
+ /// Finish the dungeon for the given group. All check are performed using internal lfg data
void FinishDungeon(uint64 gguid, uint32 dungeonId);
- LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
-
- // Queue
- void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
- void LeaveLfg(uint64 guid);
-
- // Role Check
- void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE);
-
- // Group Matching
- static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
- void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
-
- // Proposals
- uint32 AddProposal(LfgProposal& proposal);
- void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
+ /// Loads rewards for random dungeons
+ void LoadRewards();
+ /// Loads dungeons from dbc and adds teleport coords
+ void LoadLFGDungeons(bool reload = false);
- // Teleportation
- void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
+ // Multiple files
+ /// Check if given guid applied for random dungeon
+ bool selectedRandomLfgDungeon(uint64 guid);
+ /// Check if given guid applied for given map and difficulty. Used to know
+ bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty);
+ /// Get selected dungeons
+ LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
+ /// Get current lfg state
+ LfgState GetState(uint64 guid);
+ /// Get current dungeon
+ uint32 GetDungeon(uint64 guid, bool asId = true);
+ /// Get the map id of the current dungeon
+ uint32 GetDungeonMapId(uint64 guid);
+ /// Get kicks left in current group
+ uint8 GetKicksLeft(uint64 gguid);
+ /// Load Lfg group info from DB
+ void _LoadFromDB(Field* fields, uint64 guid);
+ /// Initializes player data after loading group data from DB
+ void SetupGroupMember(uint64 guid, uint64 gguid);
+ /// Return Lfg dungeon entry for given dungeon id
+ uint32 GetLFGDungeonEntry(uint32 id);
- // Vote kick
- void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason);
- void UpdateBoot(uint64 guid, bool accept);
+ // cs_lfg
+ /// Get current player roles
+ uint8 GetRoles(uint64 guid);
+ /// Get current player comment (used for LFR)
+ std::string const& GetComment(uint64 gguid);
+ /// Gets current lfg options
+ uint32 GetOptions();
+ /// Sets new lfg options
+ void SetOptions(uint32 options);
+ /// Checks if given lfg option is enabled
+ bool isOptionEnabled(uint32 option);
+ /// Clears queue - Only for internal testing
+ void Clean();
+ /// Dumps the state of the queue - Only for internal testing
+ std::string DumpQueueInfo(bool full = false);
+ // LFGScripts
+ /// Get leader of the group (using internal data)
+ uint64 GetLeader(uint64 guid);
+ /// Initializes locked dungeons for given player (called at login or level change)
void InitializeLockedDungeons(Player* player, uint8 level = 0);
-
- void SetRoles(uint64 guid, uint8 roles);
- void SetComment(uint64 guid, std::string const& comment);
+ /// Sets player team
void SetTeam(uint64 guid, uint8 team);
+ /// Sets player group
void SetGroup(uint64 guid, uint64 group);
+ /// Gets player group
+ uint64 GetGroup(uint64 guid);
+ /// Sets the leader of the group
void SetLeader(uint64 gguid, uint64 leader);
- void SetState(uint64 guid, LfgState state);
-
- void _LoadFromDB(Field* fields, uint64 guid);
- void _SaveToDB(uint64 guid, uint32 db_guid);
-
- void RemovePlayerData(uint64 guid);
+ /// Removes saved group data
void RemoveGroupData(uint64 guid);
+ /// Removes a player from a group
uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
+ /// Adds player to group
void AddPlayerToGroup(uint64 gguid, uint64 guid);
+ // LFGHandler
+ /// Get locked dungeons
LfgLockMap const& GetLockedDungeons(uint64 guid);
- LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
- uint32 GetDungeon(uint64 guid, bool asId = true);
- uint32 GetDungeonMapId(uint64 guid);
- LfgState GetState(uint64 guid);
+ /// Returns current lfg status
+ LfgUpdateData GetLfgStatus(uint64 guid);
+ /// Checks if Seasonal dungeon is active
+ bool IsSeasonActive(uint32 dungeonId);
+ /// Gets the random dungeon reward corresponding to given dungeon and player level
+ LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
+ /// Returns all random and seasonal dungeons for given level and expansion
+ LfgDungeonSet GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion);
+ /// Teleport a player to/from selected dungeon
+ void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
+ /// Inits new proposal to boot a player
+ void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason);
+ /// Updates player boot proposal with new player answer
+ void UpdateBoot(uint64 guid, bool accept);
+ /// Updates proposal to join dungeon with player answer
+ void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
+ /// Updates the role check with player answer
+ void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE);
+ /// Sets player lfg roles
+ void SetRoles(uint64 guid, uint8 roles);
+ /// Sets player lfr comment
+ void SetComment(uint64 guid, std::string const& comment);
+ /// Join Lfg with selected roles, dungeons and comment
+ void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
+ /// Leaves lfg
+ void LeaveLfg(uint64 guid);
+
+ // LfgQueue
+ /// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
LfgState GetOldState(uint64 guid);
- uint8 GetKicksLeft(uint64 gguid);
- uint64 GetLeader(uint64 guid);
+ /// Check if given group guid is lfg
bool IsLfgGroup(uint64 guid);
- uint8 GetRoles(uint64 guid);
- std::string const& GetComment(uint64 gguid);
- LfgGuidSet const& GetPlayers(uint64 guid);
+ /// Gets the player count of given group
uint8 GetPlayerCount(uint64 guid);
-
- bool IsTeleported(uint64 guid);
-
+ /// Add a new Proposal
+ uint32 AddProposal(LfgProposal& proposal);
+ /// Checks if all players are queued
bool AllQueued(LfgGuidList const& check);
- void Clean();
-
+ /// Checks if given roles match, modifies given roles map with new roles
+ static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
+ /// Checks if given players are ignoring each other
static bool HasIgnore(uint64 guid1, uint64 guid2);
+ /// Sends queue status to player
static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data);
- bool isOptionEnabled(uint32 option);
- uint32 GetOptions();
- void SetOptions(uint32 options);
- LfgUpdateData GetLfgStatus(uint64 guid);
- bool IsSeasonActive(uint32 dungeonId);
-
- std::string DumpQueueInfo(bool full = false);
- static std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
- static std::string GetRolesString(uint8 roles);
- static std::string GetStateString(LfgState state);
-
- void LoadLFGDungeons(bool reload = false);
- LFGDungeonData const* GetLFGDungeon(uint32 id);
- LFGDungeonContainer& GetLFGDungeonMap();
- void SetupGroupMember(uint64 guid, uint64 gguid);
- uint64 GetGroup(uint64 guid);
-
private:
uint8 GetTeam(uint64 guid);
void RestoreState(uint64 guid, char const* debugMsg);
@@ -389,6 +424,11 @@ class LFGMgr
void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
void SetLockedDungeons(uint64 guid, LfgLockMap const& lock);
void DecreaseKicksLeft(uint64 guid);
+ void SetState(uint64 guid, LfgState state);
+ void RemovePlayerData(uint64 guid);
+ void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
+ void _SaveToDB(uint64 guid, uint32 db_guid);
+ LFGDungeonData const* GetLFGDungeon(uint32 id);
// Proposals
void RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type);
@@ -407,6 +447,8 @@ class LFGMgr
void SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data);
void SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal);
+ LfgGuidSet const& GetPlayers(uint64 guid);
+
// General variables
uint32 m_QueueTimer; ///< used to check interval of update
uint32 m_lfgProposalId; ///< used as internal counter for proposals
@@ -423,8 +465,9 @@ class LFGMgr
LfgPlayerBootContainer BootsStore; ///< Current player kicks
LfgPlayerDataContainer PlayersStore; ///< Player data
LfgGroupDataContainer GroupsStore; ///< Group data
- LfgGuidList teleportStore; ///< Players being teleported
};
-#define sLFGMgr ACE_Singleton<LFGMgr, ACE_Null_Mutex>::instance()
+} // namespace lfg
+
+#define sLFGMgr ACE_Singleton<lfg::LFGMgr, ACE_Null_Mutex>::instance()
#endif
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp
index 410076f7e75..e8ef430bc1f 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.cpp
+++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp
@@ -17,6 +17,9 @@
#include "LFGPlayerData.h"
+namespace lfg
+{
+
LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
m_Team(0), m_Group(0), m_Roles(0), m_Comment("")
{}
@@ -122,3 +125,5 @@ LfgDungeonSet const& LfgPlayerData::GetSelectedDungeons() const
{
return m_SelectedDungeons;
}
+
+} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h
index 055924fd364..a425ce77bad 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.h
+++ b/src/server/game/DungeonFinding/LFGPlayerData.h
@@ -20,6 +20,9 @@
#include "LFG.h"
+namespace lfg
+{
+
/**
Stores all lfg data needed about the player.
*/
@@ -68,4 +71,6 @@ class LfgPlayerData
LfgDungeonSet m_SelectedDungeons; ///< Selected Dungeons when joined LFG
};
+} // namespace lfg
+
#endif
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp
index f1d2dbb313d..6a98fccecdc 100644
--- a/src/server/game/DungeonFinding/LFGQueue.cpp
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -27,6 +27,9 @@
#include "World.h"
#include "GroupMgr.h"
+namespace lfg
+{
+
/**
Given a list of guids returns the concatenation using | as delimiter
@@ -431,7 +434,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
{
std::ostringstream o;
for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it)
- o << ", " << it->first << ": " << sLFGMgr->GetRolesString(it->second);
+ o << ", " << it->first << ": " << GetRolesString(it->second);
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str());
SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_ROLES);
@@ -441,12 +444,12 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
LfgGuidList::iterator itguid = check.begin();
proposalDungeons = QueueDataStore[*itguid].dungeons;
std::ostringstream o;
- o << ", " << *itguid << ": (" << sLFGMgr->ConcatenateDungeons(proposalDungeons) << ")";
+ o << ", " << *itguid << ": (" << ConcatenateDungeons(proposalDungeons) << ")";
for (++itguid; itguid != check.end(); ++itguid)
{
LfgDungeonSet temporal;
LfgDungeonSet &dungeons = QueueDataStore[*itguid].dungeons;
- o << ", " << *itguid << ": (" << sLFGMgr->ConcatenateDungeons(dungeons) << ")";
+ o << ", " << *itguid << ": (" << ConcatenateDungeons(dungeons) << ")";
std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
proposalDungeons = temporal;
}
@@ -671,3 +674,5 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQu
--queueData.dps;
}
}
+
+} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h
index acb78d2c0f2..db7e7bbf318 100644
--- a/src/server/game/DungeonFinding/LFGQueue.h
+++ b/src/server/game/DungeonFinding/LFGQueue.h
@@ -20,6 +20,9 @@
#include "LFG.h"
+namespace lfg
+{
+
enum LfgCompatibility
{
LFG_COMPATIBILITY_PENDING,
@@ -140,4 +143,6 @@ class LFGQueue
LfgGuidList newToQueueStore; ///< New groups to add to queue
};
+} // namespace lfg
+
#endif
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 568b61eef2f..22b86a094dd 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -29,6 +29,9 @@
#include "ObjectAccessor.h"
#include "WorldSession.h"
+namespace lfg
+{
+
LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript")
{
}
@@ -85,6 +88,38 @@ void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, ui
sLFGMgr->InitializeLockedDungeons(player);
}
+void LFGPlayerScript::OnMapChanged(Player* player)
+{
+ Map const* map = player->GetMap();
+
+ if (sLFGMgr->inLfgDungeonMap(player->GetGUID(), map->GetId(), map->GetDifficulty()))
+ {
+ Group* group = player->GetGroup();
+ // This function is also called when players log in
+ // if for some reason the LFG system recognises the player as being in a LFG dungeon,
+ // but the player was loaded without a valid group, we'll teleport to homebind to prevent
+ // crashes or other undefined behaviour
+ if (!group)
+ {
+ sLFGMgr->LeaveLfg(player->GetGUID());
+ player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
+ player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, 0.0f);
+ sLog->outError(LOG_FILTER_LFG, "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! "
+ "Teleporting to homebind.", player->GetName().c_str(), player->GetGUIDLow());
+ return;
+ }
+
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ if (Player* member = itr->getSource())
+ player->GetSession()->SendNameQueryOpcode(member->GetGUID());
+
+ if (sLFGMgr->selectedRandomLfgDungeon(player->GetGUID()))
+ player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
+ }
+ else
+ player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
+}
+
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript")
{
}
@@ -208,3 +243,5 @@ void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
if (leader && !gguid)
sLFGMgr->LeaveLfg(leader);
}
+
+} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h
index 227543e1899..bb1900cad93 100644
--- a/src/server/game/DungeonFinding/LFGScripts.h
+++ b/src/server/game/DungeonFinding/LFGScripts.h
@@ -26,6 +26,9 @@
class Player;
class Group;
+namespace lfg
+{
+
class LFGPlayerScript : public PlayerScript
{
public:
@@ -36,6 +39,7 @@ class LFGPlayerScript : public PlayerScript
void OnLogout(Player* player);
void OnLogin(Player* player);
void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent);
+ void OnMapChanged(Player* player);
};
class LFGGroupScript : public GroupScript
@@ -50,3 +54,5 @@ class LFGGroupScript : public GroupScript
void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
void OnInviteMember(Group* group, uint64 guid);
};
+
+} // namespace lfg
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 93d4796f21a..39534c1c2bf 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -145,7 +145,7 @@ Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapCreature(),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLowGUID(0),
m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemoveTime(0), m_respawnTime(0),
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE),
-m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false),
+m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL)
{
@@ -289,6 +289,10 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
--diff;
}
+ // Initialize loot duplicate count depending on raid difficulty
+ if (GetMap()->Is25ManRaid())
+ loot.maxDuplicates = 3;
+
SetEntry(Entry); // normal entry always
m_creatureInfo = cinfo; // map mode related always
@@ -319,9 +323,12 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
// Load creature equipment
if (!data || data->equipmentId == 0) // use default from the template
- LoadEquipment(cinfo->equipmentId);
- else if (data && data->equipmentId != -1) // override, -1 means no equipment
+ LoadEquipment(GetOriginalEquipmentId());
+ else if (data && data->equipmentId != 0) // override, 0 means no equipment
+ {
+ m_originalEquipmentId = data->equipmentId;
LoadEquipment(data->equipmentId);
+ }
SetName(normalInfo->Name); // at normal entry always
@@ -1085,7 +1092,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
data.mapid = mapid;
data.phaseMask = phaseMask;
data.displayid = displayId;
- data.equipmentId = GetEquipmentId();
+ data.equipmentId = GetCurrentEquipmentId();
data.posX = GetPositionX();
data.posY = GetPositionY();
data.posZ = GetPositionZMinusOffset();
@@ -1120,7 +1127,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setUInt8(index++, spawnMask);
stmt->setUInt16(index++, uint16(GetPhaseMask()));
stmt->setUInt32(index++, displayId);
- stmt->setInt32(index++, int32(GetEquipmentId()));
+ stmt->setInt32(index++, int32(GetCurrentEquipmentId()));
stmt->setFloat(index++, GetPositionX());
stmt->setFloat(index++, GetPositionY());
stmt->setFloat(index++, GetPositionZ());
@@ -1266,14 +1273,14 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
if (!vehId)
vehId = cinfo->VehicleId;
- if (vehId && !CreateVehicleKit(vehId, Entry))
- vehId = 0;
-
Object::_Create(guidlow, Entry, vehId ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
if (!UpdateEntry(Entry, team, data))
return false;
+ if (vehId && !CreateVehicleKit(vehId, Entry))
+ vehId = 0;
+
return true;
}
@@ -1351,24 +1358,24 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
return true;
}
-void Creature::LoadEquipment(uint32 equip_entry, bool force)
+void Creature::LoadEquipment(int8 id, bool force /*= true*/)
{
- if (equip_entry == 0)
+ if (id == 0)
{
if (force)
{
- for (uint8 i = 0; i < 3; ++i)
+ for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, 0);
m_equipmentId = 0;
}
return;
}
- EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(equip_entry);
+ EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(GetEntry(), id);
if (!einfo)
return;
- m_equipmentId = equip_entry;
+ m_equipmentId = id;
for (uint8 i = 0; i < 3; ++i)
SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->ItemEntry[i]);
}
@@ -2105,9 +2112,11 @@ bool Creature::LoadCreaturesAddon(bool reload)
SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF));
//! Suspected correlation between UNIT_FIELD_BYTES_1, offset 3, value 0x2:
- //! If no inhabittype_fly (if no MovementFlag_DisableGravity flag found in sniffs)
+ //! If no inhabittype_fly (if no MovementFlag_DisableGravity or MovementFlag_CanFly flag found in sniffs)
+ //! Check using InhabitType as movement flags are assigned dynamically
+ //! basing on whether the creature is in air or not
//! Set MovementFlag_Hover. Otherwise do nothing.
- if (GetByteValue(UNIT_FIELD_BYTES_1, 3) & UNIT_BYTE1_FLAG_HOVER && !IsLevitating())
+ if (GetByteValue(UNIT_FIELD_BYTES_1, 3) & UNIT_BYTE1_FLAG_HOVER && !(GetCreatureTemplate()->InhabitType & INHABIT_AIR))
AddUnitMovementFlag(MOVEMENTFLAG_HOVER);
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index efc4e44798f..e8996db608f 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -136,7 +136,6 @@ struct CreatureTemplate
uint32 questItems[MAX_CREATURE_QUEST_ITEMS];
uint32 movementId;
bool RegenHealth;
- uint32 equipmentId;
uint32 MechanicImmuneMask;
uint32 flags_extra;
uint32 ScriptID;
@@ -236,7 +235,8 @@ struct EquipmentInfo
};
// Benchmarked: Faster than std::map (insert/find)
-typedef UNORDERED_MAP<uint16, EquipmentInfo> EquipmentInfoContainer;
+typedef UNORDERED_MAP<uint8, EquipmentInfo> EquipmentInfoContainerInternal;
+typedef UNORDERED_MAP<uint32, EquipmentInfoContainerInternal> EquipmentInfoContainer;
// from `creature` table
struct CreatureData
@@ -246,7 +246,7 @@ struct CreatureData
uint16 mapid;
uint16 phaseMask;
uint32 displayid;
- int32 equipmentId;
+ int8 equipmentId;
float posX;
float posY;
float posZ;
@@ -454,13 +454,12 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData* data = NULL);
bool LoadCreaturesAddon(bool reload = false);
void SelectLevel(const CreatureTemplate* cinfo);
- void LoadEquipment(uint32 equip_entry, bool force=false);
+ void LoadEquipment(int8 id = 1, bool force = false);
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
void Update(uint32 time); // overwrited Unit::Update
void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
- uint32 GetEquipmentId() const { return GetCreatureTemplate()->equipmentId; }
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
uint32 GetCorpseDelay() const { return m_corpseDelay; }
@@ -558,8 +557,11 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void UpdateMaxPower(Powers power);
void UpdateAttackPowerAndDamage(bool ranged = false);
void UpdateDamagePhysical(WeaponAttackType attType);
- uint32 GetCurrentEquipmentId() { return m_equipmentId; }
- void SetCurrentEquipmentId(uint32 entry) { m_equipmentId = entry; }
+
+ int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
+ uint8 GetCurrentEquipmentId() { return m_equipmentId; }
+ void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; }
+
float GetSpellDamageMod(int32 Rank);
VendorItemData const* GetVendorItems() const;
@@ -754,7 +756,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void Regenerate(Powers power);
MovementGeneratorType m_defaultMovementType;
uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
- uint32 m_equipmentId;
+ uint8 m_equipmentId;
+ int8 m_originalEquipmentId; // can be -1
bool m_AlreadyCallAssistance;
bool m_AlreadySearchedAssistance;
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index f5877a3b927..a2305a8a56d 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -142,6 +142,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
data << uint32(_questMenu.GetMenuItemCount()); // max count 0x20
+ // Store this instead of checking the Singleton every loop iteration
+ bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
+
for (uint8 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& item = _questMenu.GetItem(i);
@@ -160,6 +163,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
+ if (questLevelInTitle)
+ AddQuestLevelToTitle(title, quest->GetQuestLevel());
+
data << title; // max 0x200
}
@@ -252,6 +258,10 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
size_t count_pos = data.wpos();
data << uint8 (_questMenu.GetMenuItemCount());
uint32 count = 0;
+
+ // Store this instead of checking the Singleton every loop iteration
+ bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
+
for (; count < _questMenu.GetMenuItemCount(); ++count)
{
QuestMenuItem const& qmi = _questMenu.GetItem(count);
@@ -267,6 +277,9 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
+ if (questLevelInTitle)
+ AddQuestLevelToTitle(title, quest->GetQuestLevel());
+
data << uint32(questID);
data << uint32(qmi.QuestIcon);
data << int32(quest->GetQuestLevel());
@@ -310,6 +323,9 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
}
}
+ if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
+ AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
+
WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size
data << uint64(npcGUID);
data << uint64(0); // wotlk, something todo with quest sharing?
@@ -499,6 +515,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
data << float(quest->GetPointY());
data << uint32(quest->GetPointOpt());
+ if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
+ AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
+
data << questTitle;
data << questObjectives;
data << questDetails;
@@ -545,6 +564,9 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
}
}
+ if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
+ AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
+
WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 50); // guess size
data << uint64(npcGUID);
data << uint32(quest->GetQuestId());
@@ -645,6 +667,9 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
return;
}
+ if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
+ AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
+
WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size
data << uint64(npcGUID);
data << uint32(quest->GetQuestId());
@@ -694,3 +719,13 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
_session->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
}
+
+void PlayerMenu::AddQuestLevelToTitle(std::string &title, int32 level)
+{
+ // Adds the quest level to the front of the quest title
+ // example: [13] Westfall Stew
+
+ std::stringstream questTitlePretty;
+ questTitlePretty << "[" << level << "] " << title;
+ title = questTitlePretty.str();
+}
diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h
index 6c5f465bbf0..f13f19bba55 100644
--- a/src/server/game/Entities/Creature/GossipDef.h
+++ b/src/server/game/Entities/Creature/GossipDef.h
@@ -277,6 +277,8 @@ class PlayerMenu
void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const;
void SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const;
+ static void AddQuestLevelToTitle(std::string &title, int32 level);
+
private:
GossipMenu _gossipMenu;
QuestMenu _questMenu;
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index a96d9ab33d0..dc3347c5b4f 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -21,6 +21,22 @@
#include "Creature.h"
+enum SummonerType
+{
+ SUMMONER_TYPE_CREATURE = 0,
+ SUMMONER_TYPE_GAMEOBJECT = 1,
+ SUMMONER_TYPE_MAP = 2
+};
+
+/// Stores data for temp summons
+struct TempSummonData
+{
+ uint32 entry; ///< Entry of summoned creature
+ Position pos; ///< Position, where should be creature spawned
+ TempSummonType type; ///< Summon type, see TempSummonType for available types
+ uint32 time; ///< Despawn time, usable only with certain temp summon types
+};
+
class TempSummon : public Creature
{
public:
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index bf0fbb4199d..c41c8e71a44 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -258,6 +258,10 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
LastUsedScriptID = GetGOInfo()->ScriptId;
AIM_Initialize();
+ // Initialize loot duplicate count depending on raid difficulty
+ if (map->Is25ManRaid())
+ loot.maxDuplicates = 3;
+
return true;
}
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index 2b887672ec4..6a530a771f6 100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -74,7 +74,7 @@ void LoadRandomEnchantmentsTable()
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
uint32 GetItemEnchantMod(int32 entry)
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index f20d452dc96..79bf656c318 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -509,7 +509,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
WPAssert(updateMask && updateMask->GetCount() == m_valuesCount);
*data << (uint8)updateMask->GetBlockCount();
- data->append(updateMask->GetMask(), updateMask->GetLength());
+ updateMask->AppendToPacket(data);
// 2 specialized loops for speed optimization in non-unit case
if (isType(TYPEMASK_UNIT)) // unit (creature/player) case
@@ -777,64 +777,57 @@ void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) cons
BuildValuesUpdateBlockForPlayer(&iter->second, iter->first);
}
-void Object::GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const
+uint32 Object::GetUpdateFieldData(Player const* target, uint32*& flags) const
{
- // This function assumes updatefield index is always valid
+ uint32 visibleFlag = UF_FLAG_PUBLIC;
+
+ if (target == this)
+ visibleFlag |= UF_FLAG_PRIVATE;
+
switch (GetTypeId())
{
case TYPEID_ITEM:
case TYPEID_CONTAINER:
flags = ItemUpdateFieldFlags;
- isOwner = isItemOwner = ((Item*)this)->GetOwnerGUID() == target->GetGUID();
+ if (((Item*)this)->GetOwnerGUID() == target->GetGUID())
+ visibleFlag |= UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER;
break;
case TYPEID_UNIT:
case TYPEID_PLAYER:
{
Player* plr = ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself();
flags = UnitUpdateFieldFlags;
- isOwner = ToUnit()->GetOwnerGUID() == target->GetGUID();
- hasSpecialInfo = ToUnit()->HasAuraTypeWithCaster(SPELL_AURA_EMPATHY, target->GetGUID());
- isPartyMember = plr && plr->IsInSameGroupWith(target);
+ if (ToUnit()->GetOwnerGUID() == target->GetGUID())
+ visibleFlag |= UF_FLAG_OWNER;
+
+ if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO))
+ if (ToUnit()->HasAuraTypeWithCaster(SPELL_AURA_EMPATHY, target->GetGUID()))
+ visibleFlag |= UF_FLAG_SPECIAL_INFO;
+
+ if (plr && plr->IsInSameRaidWith(target))
+ visibleFlag |= UF_FLAG_PARTY_MEMBER;
break;
}
case TYPEID_GAMEOBJECT:
flags = GameObjectUpdateFieldFlags;
- isOwner = ToGameObject()->GetOwnerGUID() == target->GetGUID();
+ if (ToGameObject()->GetOwnerGUID() == target->GetGUID())
+ visibleFlag |= UF_FLAG_OWNER;
break;
case TYPEID_DYNAMICOBJECT:
flags = DynamicObjectUpdateFieldFlags;
- isOwner = ((DynamicObject*)this)->GetCasterGUID() == target->GetGUID();
+ if (((DynamicObject*)this)->GetCasterGUID() == target->GetGUID())
+ visibleFlag |= UF_FLAG_OWNER;
break;
case TYPEID_CORPSE:
flags = CorpseUpdateFieldFlags;
- isOwner = ToCorpse()->GetOwnerGUID() == target->GetGUID();
+ if (ToCorpse()->GetOwnerGUID() == target->GetGUID())
+ visibleFlag |= UF_FLAG_OWNER;
break;
case TYPEID_OBJECT:
break;
}
-}
-
-bool Object::IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool isItemOwner, bool isPartyMember) const
-{
- if (flags == UF_FLAG_NONE)
- return false;
-
- if (flags & UF_FLAG_PUBLIC)
- return true;
-
- if (flags & UF_FLAG_PRIVATE && isSelf)
- return true;
-
- if (flags & UF_FLAG_OWNER && isOwner)
- return true;
-
- if (flags & UF_FLAG_ITEM_OWNER && isItemOwner)
- return true;
-
- if (flags & UF_FLAG_PARTY_MEMBER && isPartyMember)
- return true;
- return false;
+ return visibleFlag;
}
void Object::_LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count)
@@ -857,16 +850,10 @@ void Object::_LoadIntoDataField(std::string const& data, uint32 startOffset, uin
void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
{
uint32* flags = NULL;
- bool isSelf = target == this;
- bool isOwner = false;
- bool isItemOwner = false;
- bool hasSpecialInfo = false;
- bool isPartyMember = false;
-
- GetUpdateFieldData(target, flags, isOwner, isItemOwner, hasSpecialInfo, isPartyMember);
+ uint32 visibleFlag = GetUpdateFieldData(target, flags);
for (uint16 index = 0; index < m_valuesCount; ++index)
- if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (_changesMask.GetBit(index) && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember)))
+ if (_fieldNotifyFlags & flags[index] || ((flags[index] & visibleFlag) & UF_FLAG_SPECIAL_INFO) || (_changesMask.GetBit(index) && (flags[index] & visibleFlag)))
updateMask->SetBit(index);
}
@@ -874,16 +861,10 @@ void Object::_SetCreateBits(UpdateMask* updateMask, Player* target) const
{
uint32* value = m_uint32Values;
uint32* flags = NULL;
- bool isSelf = target == this;
- bool isOwner = false;
- bool isItemOwner = false;
- bool hasSpecialInfo = false;
- bool isPartyMember = false;
-
- GetUpdateFieldData(target, flags, isOwner, isItemOwner, hasSpecialInfo, isPartyMember);
+ uint32 visibleFlag = GetUpdateFieldData(target, flags);
for (uint16 index = 0; index < m_valuesCount; ++index, ++value)
- if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (*value && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember)))
+ if (_fieldNotifyFlags & flags[index] || ((flags[index] & visibleFlag) & UF_FLAG_SPECIAL_INFO) || (*value && (flags[index] & visibleFlag)))
updateMask->SetBit(index);
}
@@ -2334,6 +2315,24 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
return summon;
}
+/**
+* Summons group of creatures.
+*
+* @param group Id of group to summon.
+* @param list List to store pointers to summoned creatures.
+*/
+
+void Map::SummonCreatureGroup(uint8 group, std::list<TempSummon*>& list)
+{
+ std::vector<TempSummonData> const* data = sObjectMgr->GetSummonGroup(GetId(), SUMMONER_TYPE_MAP, group);
+ if (!data)
+ return;
+
+ for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
+ if (TempSummon* summon = SummonCreature(itr->entry, itr->pos, NULL, itr->time))
+ list.push_back(summon);
+}
+
void WorldObject::SetZoneScript()
{
if (Map* map = FindMap())
@@ -2413,6 +2412,25 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
return summon;
}
+/**
+* Summons group of creatures. Should be called only by instances of Creature and GameObject classes.
+*
+* @param group Id of group to summon.
+* @param list List to store pointers to summoned creatures.
+*/
+void WorldObject::SummonCreatureGroup(uint8 group, std::list<TempSummon*>& list)
+{
+ ASSERT((GetTypeId() == TYPEID_GAMEOBJECT || GetTypeId() == TYPEID_UNIT) && "Only GOs and creatures can summon npc groups!");
+
+ std::vector<TempSummonData> const* data = sObjectMgr->GetSummonGroup(GetEntry(), GetTypeId() == TYPEID_GAMEOBJECT ? SUMMONER_TYPE_GAMEOBJECT : SUMMONER_TYPE_CREATURE, group);
+ if (!data)
+ return;
+
+ for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
+ if (TempSummon* summon = SummonCreature(itr->entry, itr->pos, itr->type, itr->time))
+ list.push_back(summon);
+}
+
Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive) const
{
Creature* creature = NULL;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 641f9afb154..ae788621368 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -326,9 +326,7 @@ class Object
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
void _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count);
- void GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const;
-
- bool IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool isItemOwner, bool isPartyMember) const;
+ uint32 GetUpdateFieldData(Player const* target, uint32*& flags) const;
void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
@@ -795,6 +793,7 @@ class WorldObject : public Object, public WorldLocation
}
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime);
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL);
+ void SummonCreatureGroup(uint8 group, std::list<TempSummon*>& list);
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
GameObject* FindNearestGameObject(uint32 entry, float range) const;
diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h
index 784c4eba96f..8be8dfecdaf 100644
--- a/src/server/game/Entities/Object/Updates/UpdateMask.h
+++ b/src/server/game/Entities/Object/Updates/UpdateMask.h
@@ -21,106 +21,106 @@
#include "UpdateFields.h"
#include "Errors.h"
+#include "ByteBuffer.h"
class UpdateMask
{
public:
- UpdateMask() : mCount(0), mBlocks(0), mUpdateMask(0) { }
- UpdateMask(UpdateMask const& mask) : mUpdateMask(0) { *this = mask; }
+ /// Type representing how client reads update mask
+ typedef uint32 ClientUpdateMaskType;
- ~UpdateMask()
+ enum UpdateMaskCount
{
- delete[] mUpdateMask;
- }
+ CLIENT_UPDATE_MASK_BITS = sizeof(ClientUpdateMaskType) * 8,
+ };
- void SetBit(uint32 index)
- {
- ((uint8*)mUpdateMask)[index >> 3] |= 1 << (index & 0x7);
- }
+ UpdateMask() : _fieldCount(0), _blockCount(0), _bits(NULL) { }
- void UnsetBit(uint32 index)
+ UpdateMask(UpdateMask const& right)
{
- ((uint8*)mUpdateMask)[index >> 3] &= (0xff ^ (1 << (index & 0x7)));
+ SetCount(right.GetCount());
+ memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * 32);
}
- bool GetBit(uint32 index) const
+ ~UpdateMask() { delete[] _bits; }
+
+ void SetBit(uint32 index) { _bits[index] = 1; }
+ void UnsetBit(uint32 index) { _bits[index] = 0; }
+ bool GetBit(uint32 index) const { return _bits[index] != 0; }
+
+ void AppendToPacket(ByteBuffer* data)
{
- return (((uint8*)mUpdateMask)[index >> 3] & (1 << (index & 0x7))) != 0;
+ for (uint32 i = 0; i < GetBlockCount(); ++i)
+ {
+ ClientUpdateMaskType maskPart = 0;
+ for (uint32 j = 0; j < CLIENT_UPDATE_MASK_BITS; ++j)
+ if (_bits[CLIENT_UPDATE_MASK_BITS * i + j])
+ maskPart |= 1 << j;
+
+ *data << maskPart;
+ }
}
- uint32 GetBlockCount() const { return mBlocks; }
- uint32 GetLength() const { return mBlocks << 2; }
- uint32 GetCount() const { return mCount; }
- uint8* GetMask() { return (uint8*)mUpdateMask; }
+ uint32 GetBlockCount() const { return _blockCount; }
+ uint32 GetCount() const { return _fieldCount; }
- void SetCount (uint32 valuesCount)
+ void SetCount(uint32 valuesCount)
{
- delete [] mUpdateMask;
+ delete[] _bits;
- mCount = valuesCount;
- mBlocks = (valuesCount + 31) / 32;
+ _fieldCount = valuesCount;
+ _blockCount = (valuesCount + CLIENT_UPDATE_MASK_BITS - 1) / CLIENT_UPDATE_MASK_BITS;
- mUpdateMask = new uint32[mBlocks];
- memset(mUpdateMask, 0, mBlocks << 2);
+ _bits = new uint8[_blockCount * CLIENT_UPDATE_MASK_BITS];
+ memset(_bits, 0, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS);
}
void Clear()
{
- if (mUpdateMask)
- memset(mUpdateMask, 0, mBlocks << 2);
+ if (_bits)
+ memset(_bits, 0, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS);
}
- UpdateMask& operator=(UpdateMask const& mask)
+ UpdateMask& operator=(UpdateMask const& right)
{
- if (this == &mask)
+ if (this == &right)
return *this;
- SetCount(mask.mCount);
- memcpy(mUpdateMask, mask.mUpdateMask, mBlocks << 2);
-
+ SetCount(right.GetCount());
+ memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS);
return *this;
}
- void operator&=(UpdateMask const& mask)
+ UpdateMask& operator&=(UpdateMask const& right)
{
- ASSERT(mask.mCount <= mCount);
- for (uint32 i = 0; i < mBlocks; ++i)
- mUpdateMask[i] &= mask.mUpdateMask[i];
- }
+ ASSERT(right.GetCount() <= GetCount());
+ for (uint32 i = 0; i < _fieldCount; ++i)
+ _bits[i] &= right._bits[i];
- void operator|=(UpdateMask const& mask)
- {
- ASSERT(mask.mCount <= mCount);
- for (uint32 i = 0; i < mBlocks; ++i)
- mUpdateMask[i] |= mask.mUpdateMask[i];
+ return *this;
}
- UpdateMask operator&(UpdateMask const& mask) const
+ UpdateMask& operator|=(UpdateMask const& right)
{
- ASSERT(mask.mCount <= mCount);
+ ASSERT(right.GetCount() <= GetCount());
+ for (uint32 i = 0; i < _fieldCount; ++i)
+ _bits[i] |= right._bits[i];
- UpdateMask newmask;
- newmask = *this;
- newmask &= mask;
-
- return newmask;
+ return *this;
}
- UpdateMask operator|(UpdateMask const& mask) const
+ UpdateMask operator|(UpdateMask const& right)
{
- ASSERT(mask.mCount <= mCount);
-
- UpdateMask newmask;
- newmask = *this;
- newmask |= mask;
-
- return newmask;
+ UpdateMask ret(*this);
+ ret |= right;
+ return ret;
}
private:
- uint32 mCount;
- uint32 mBlocks;
- uint32 *mUpdateMask;
+ uint32 _fieldCount;
+ uint32 _blockCount;
+ uint8* _bits;
};
+
#endif
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 66162142fdc..a8a500c093a 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -668,7 +668,7 @@ Player::Player(WorldSession* session): Unit(true)
//m_pad = 0;
// players always accept
- if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
+ if (!GetSession()->HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS))
SetAcceptWhispers(true);
m_curSelection = 0;
@@ -1018,7 +1018,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
: sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
- if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
+ if (m_session->HasPermission(RBAC_PERM_USE_START_GM_LEVEL))
{
uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL);
if (gm_level > start_level)
@@ -1575,7 +1575,9 @@ void Player::Update(uint32 p_time)
GetSession()->m_muteTime = 0;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
stmt->setInt64(0, 0); // Set the mute time to 0
- stmt->setUInt32(1, GetSession()->GetAccountId());
+ stmt->setString(1, "");
+ stmt->setString(2, "");
+ stmt->setUInt32(3, GetSession()->GetAccountId());
LoginDatabase.Execute(stmt);
}
@@ -2067,7 +2069,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
return false;
}
- if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
+ if (!GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_DISABLE_MAP) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
{
sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName().c_str(), mapid);
SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED);
@@ -3118,7 +3120,7 @@ void Player::InitTalentForLevel()
// if used more that have then reset
if (m_usedTalentCount > talentPointsForLevel)
{
- if (!AccountMgr::IsAdminAccount(GetSession()->GetSecurity()))
+ if (!GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_MORE_TALENTS_THAN_ALLOWED))
resetTalents(true);
else
SetFreeTalentPoints(0);
@@ -4883,7 +4885,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
stmt->setUInt32(0, guid);
trans->Append(stmt);
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER);
stmt->setUInt32(0, guid);
trans->Append(stmt);
@@ -7374,6 +7376,9 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
float posy = fields[2].GetFloat();
float posz = fields[3].GetFloat();
+ if (!sMapStore.LookupEntry(map))
+ return 0;
+
zone = sMapMgr->GetZoneId(map, posx, posy, posz);
if (zone > 0)
@@ -7443,18 +7448,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
}
// group update
- if (Group* group = GetGroup())
- {
+ if (GetGroup())
SetGroupUpdateFlag(GROUP_UPDATE_FULL);
- if (GetSession() && group->isLFGGroup() && sLFGMgr->IsTeleported(GetGUID()))
- {
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- if (Player* member = itr->getSource())
- GetSession()->SendNameQueryOpcode(member->GetGUID());
- }
- }
- }
m_zoneUpdateId = newZone;
m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL;
@@ -11913,22 +11908,12 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObject const* lootedObject) const
{
- LfgDungeonSet const& dungeons = sLFGMgr->GetSelectedDungeons(GetGUID());
- if (dungeons.empty())
- return EQUIP_ERR_OK; // not using LFG
-
if (!GetGroup() || !GetGroup()->isLFGGroup())
return EQUIP_ERR_OK; // not in LFG group
// check if looted object is inside the lfg dungeon
- bool lootedObjectInDungeon = false;
Map const* map = lootedObject->GetMap();
- if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true))
- if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId))
- if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
- lootedObjectInDungeon = true;
-
- if (!lootedObjectInDungeon)
+ if (!sLFGMgr->inLfgDungeonMap(GetGroup()->GetGUID(), map->GetId(), map->GetDifficulty()))
return EQUIP_ERR_OK;
if (!proto)
@@ -14291,7 +14276,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
VendorItemData const* vendorItems = creature->GetVendorItems();
if (!vendorItems || vendorItems->Empty())
{
- sLog->outError(LOG_FILTER_SQL, "Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u, Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
canTalk = false;
}
break;
@@ -16789,7 +16774,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// check name limitations
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
- (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sObjectMgr->IsReservedName(m_name)))
+ (!GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) &&
+ sObjectMgr->IsReservedName(m_name)))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
@@ -17324,7 +17310,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
outDebugValues();
// GM state
- if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
+ if (GetSession()->HasPermission(RBAC_PERM_RESTORE_SAVED_GM_STATE))
{
switch (sWorld->getIntConfig(CONFIG_GM_LOGIN_STATE))
{
@@ -19643,7 +19629,7 @@ void Player::outDebugValues() const
void Player::UpdateSpeakTime()
{
// ignore chat spam protection for GMs in any mode
- if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
+ if (!GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_CHAT_SPAM))
return;
time_t current = time (NULL);
@@ -21760,12 +21746,21 @@ void Player::LeaveBattleground(bool teleportToEntryPoint)
}
}
-bool Player::CanJoinToBattleground(Battleground const* /*bg*/) const
+bool Player::CanJoinToBattleground(Battleground const* bg) const
{
// check Deserter debuff
if (HasAura(26013))
return false;
+ if (bg->isArena() && !GetSession()->HasPermission(RBAC_PERM_JOIN_ARENAS))
+ return false;
+
+ if (bg->IsRandom() && !GetSession()->HasPermission(RBAC_PERM_JOIN_RANDOM_BG))
+ return false;
+
+ if (!GetSession()->HasPermission(RBAC_PERM_JOIN_NORMAL_BG))
+ return false;
+
return true;
}
@@ -22049,26 +22044,28 @@ void Player::InitPrimaryProfessions()
SetFreePrimaryProfessions(sWorld->getIntConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL));
}
-void Player::ModifyMoney(int32 d)
+bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/)
{
- sScriptMgr->OnPlayerMoneyChanged(this, d);
+ if (!amount)
+ return true;
- if (d < 0)
- SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0);
+ sScriptMgr->OnPlayerMoneyChanged(this, amount);
+
+ if (amount < 0)
+ SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
else
{
- uint32 newAmount = 0;
- if (GetMoney() < uint32(MAX_MONEY_AMOUNT - d))
- newAmount = GetMoney() + d;
+ if (GetMoney() < uint32(MAX_MONEY_AMOUNT - amount))
+ SetMoney(GetMoney() + amount);
else
{
- // "At Gold Limit"
- newAmount = MAX_MONEY_AMOUNT;
- if (d)
+ if (sendError)
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
+ return false;
}
- SetMoney (newAmount);
}
+
+ return true;
}
Unit* Player::GetSelectedUnit() const
@@ -23424,14 +23421,14 @@ PartyResult Player::CanUninviteFromGroup() const
if (!sLFGMgr->GetKicksLeft(gguid))
return ERR_PARTY_LFG_BOOT_LIMIT;
- LfgState state = sLFGMgr->GetState(gguid);
- if (state == LFG_STATE_BOOT)
+ lfg::LfgState state = sLFGMgr->GetState(gguid);
+ if (state == lfg::LFG_STATE_BOOT)
return ERR_PARTY_LFG_BOOT_IN_PROGRESS;
- if (grp->GetMembersCount() <= LFG_GROUP_KICK_VOTES_NEEDED)
+ if (grp->GetMembersCount() <= lfg::LFG_GROUP_KICK_VOTES_NEEDED)
return ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS;
- if (state == LFG_STATE_FINISHED_DUNGEON)
+ if (state == lfg::LFG_STATE_FINISHED_DUNGEON)
return ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE;
if (grp->isRollLootActive())
@@ -23461,21 +23458,17 @@ PartyResult Player::CanUninviteFromGroup() const
bool Player::isUsingLfg()
{
- return sLFGMgr->GetState(GetGUID()) != LFG_STATE_NONE;
+ return sLFGMgr->GetState(GetGUID()) != lfg::LFG_STATE_NONE;
}
bool Player::inRandomLfgDungeon()
{
- if (isUsingLfg())
+ if (sLFGMgr->selectedRandomLfgDungeon(GetGUID()))
{
- const LfgDungeonSet& dungeons = sLFGMgr->GetSelectedDungeons(GetGUID());
- if (!dungeons.empty())
- {
- LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(*dungeons.begin());
- if (dungeon && (dungeon->type == LFG_TYPE_RANDOM || dungeon->seasonal))
- return true;
- }
+ Map const* map = GetMap();
+ return sLFGMgr->inLfgDungeonMap(GetGUID(), map->GetId(), map->GetDifficulty());
}
+
return false;
}
@@ -25492,7 +25485,7 @@ bool Player::AddItem(uint32 itemId, uint32 count)
ItemPosCountVec dest;
InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK)
- count = noSpaceForCount;
+ count -= noSpaceForCount;
if (count == 0 || dest.empty())
{
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index a69f8c44715..362b6aca631 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -28,6 +28,7 @@
#include "QuestDef.h"
#include "SpellMgr.h"
#include "Unit.h"
+#include "Opcodes.h"
#include <string>
#include <vector>
@@ -1546,7 +1547,7 @@ class Player : public Unit, public GridObject<Player>
void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
uint32 GetMoney() const { return GetUInt32Value(PLAYER_FIELD_COINAGE); }
- void ModifyMoney(int32 d);
+ bool ModifyMoney(int32 amount, bool sendError = true);
bool HasEnoughMoney(uint32 amount) const { return (GetMoney() >= amount); }
bool HasEnoughMoney(int32 amount) const
{
@@ -1628,6 +1629,11 @@ class Player : public Unit, public GridObject<Player>
return mMitems.erase(id) ? true : false;
}
+ void SendOnCancelExpectedVehicleRideAura()
+ {
+ WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
+ GetSession()->SendPacket(&data);
+ }
void PetSpellInitialize();
void CharmSpellInitialize();
void PossessSpellInitialize();
diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp
index e5bbac59e00..7a2b36e23bf 100644
--- a/src/server/game/Entities/Player/SocialMgr.cpp
+++ b/src/server/game/Entities/Player/SocialMgr.cpp
@@ -216,34 +216,38 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri
friendInfo.Level = 0;
friendInfo.Class = 0;
- Player* pFriend = ObjectAccessor::FindPlayer(friendGUID);
- if (!pFriend)
+ Player* target = ObjectAccessor::FindPlayer(friendGUID);
+ if (!target)
return;
- uint32 team = player->GetTeam();
- AccountTypes security = player->GetSession()->GetSecurity();
- 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);
if (itr != player->GetSocial()->m_playerSocialMap.end())
friendInfo.Note = itr->second.Note;
// 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->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) &&
- pFriend->IsVisibleGloballyFor(player))
+
+ if (!player->GetSession()->HasPermission(RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS) &&
+ target->GetSession()->GetSecurity() > AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST)))
+ return;
+
+ // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST
+ if (target->GetTeam() != player->GetTeam() &&
+ !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST) && !player->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_WHO_LIST))
+ return;
+
+ if (target->IsVisibleGloballyFor(player))
{
- friendInfo.Status = FRIEND_STATUS_ONLINE;
- if (pFriend->isAFK())
- friendInfo.Status = FRIEND_STATUS_AFK;
- if (pFriend->isDND())
+ if (target->isDND())
friendInfo.Status = FRIEND_STATUS_DND;
- friendInfo.Area = pFriend->GetZoneId();
- friendInfo.Level = pFriend->getLevel();
- friendInfo.Class = pFriend->getClass();
+ else if (target->isAFK())
+ friendInfo.Status = FRIEND_STATUS_AFK;
+ else
+ friendInfo.Status = FRIEND_STATUS_ONLINE;
+
+ friendInfo.Area = target->GetZoneId();
+ friendInfo.Level = target->getLevel();
+ friendInfo.Class = target->getClass();
}
}
@@ -295,28 +299,29 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
if (!player)
return;
- uint32 team = player->GetTeam();
- AccountTypes security = player->GetSession()->GetSecurity();
- uint32 guid = player->GetGUIDLow();
- AccountTypes gmLevelInWhoList = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
- bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
-
for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr)
{
- PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(guid);
+ PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(player->GetGUID());
if (itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND))
{
- Player* pFriend = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
+ Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
+ if (!target || !target->IsInWorld())
+ continue;
+
+ if (!target->GetSession()->HasPermission(RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS) &&
+ player->GetSession()->GetSecurity() > AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST)))
+ continue;
+
+ // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST
+ if (target->GetTeam() != player->GetTeam() &&
+ !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST) &&
+ !target->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_WHO_LIST))
+ continue;
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
- if (pFriend && pFriend->IsInWorld() &&
- (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) ||
- ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) &&
- player->IsVisibleGloballyFor(pFriend))
- {
- pFriend->GetSession()->SendPacket(packet);
- }
+ if (player->IsVisibleGloballyFor(target))
+ target->GetSession()->SendPacket(packet);
}
}
}
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 3ce23a973ca..c2c01331b4d 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -680,9 +680,9 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
void Transport::UpdatePosition(MovementInfo* mi)
{
- float transport_o = mi->pos.m_orientation - mi->t_pos.m_orientation;
- float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY* std::sin(transport_o));
- float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX* std::sin(transport_o));
+ float transport_o = mi->pos.GetOrientation() - mi->t_pos.GetOrientation();
+ float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY * std::sin(transport_o));
+ float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX * std::sin(transport_o));
float transport_z = mi->pos.m_positionZ - mi->t_pos.m_positionZ;
Relocate(transport_x, transport_y, transport_z, transport_o);
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 5cf0550905c..0024d726060 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -229,8 +229,7 @@ void Player::UpdateArmor()
float Player::GetHealthBonusFromStamina()
{
float stamina = GetStat(STAT_STAMINA);
-
- float baseStam = stamina < 20 ? stamina : 20;
+ float baseStam = std::min(20.0f, stamina);
float moreStam = stamina - baseStam;
return baseStam + (moreStam*10.0f);
@@ -240,10 +239,10 @@ float Player::GetManaBonusFromIntellect()
{
float intellect = GetStat(STAT_INTELLECT);
- float baseInt = intellect < 20 ? intellect : 20;
+ float baseInt = std::min(20.0f, intellect);
float moreInt = intellect - baseInt;
- return baseInt + (moreInt*15.0f);
+ return baseInt + (moreInt * 15.0f);
}
void Player::UpdateMaxHealth()
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index b8a64fda53e..00f771b1f54 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3147,7 +3147,9 @@ void Unit::DeMorph()
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
{
ASSERT(casterGUID || caster);
- if (!casterGUID)
+
+ // Check if these can stack anyway
+ if (!casterGUID && !newAura->IsStackableOnOneSlotWithDifferentCasters())
casterGUID = caster->GetGUID();
// passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
@@ -8462,48 +8464,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
break;
}
- // Shadow's Fate (Shadowmourne questline)
- case 71169:
- {
- // Victim needs more checks so bugs, rats or summons can not be affected by the proc.
- if (GetTypeId() != TYPEID_PLAYER || !victim || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER)
- return false;
-
- Player* player = ToPlayer();
- if (player->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE)
- {
- break;
- }
- else if (player->GetDifficulty(true) == RAID_DIFFICULTY_25MAN_NORMAL || player->GetDifficulty(true) == RAID_DIFFICULTY_25MAN_HEROIC)
- {
- uint32 spellId = 0;
- uint32 questId = 0;
- switch (victim->GetEntry())
- {
- case 36678: // NPC: Professor Putricide
- questId = 24749; // Quest: Unholy Infusion
- spellId = 71516; // Spell: Shadow Infusion
- break;
- case 37955: // NPC: Blood-Queen Lana'thel
- questId = 24756; // Quest: Blood Infusion
- spellId = 72154; // Spell: Thirst Quenched
- break;
- case 36853: // NPC: Sindragosa
- questId = 24757; // Quest: Frost Infusion
- spellId = 72290; // Spell: Frost-Imbued Blade
- break;
- default:
- return false;
- }
-
- if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId))
- return false;
-
- break;
- }
- else
- return false;
- }
}
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(trigger_spell_id))
@@ -11233,7 +11193,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() & GetMeleeDamageSchoolMask())
+ if ((*i)->GetMiscValue() & attacker->GetMeleeDamageSchoolMask())
TakenFlatBenefit += (*i)->GetAmount();
if (attType != RANGED_ATTACK)
@@ -11245,7 +11205,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
float TakenTotalMod = 1.0f;
// ..taken
- TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask());
+ TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, attacker->GetMeleeDamageSchoolMask());
// .. taken pct (special attacks)
if (spellProto)
@@ -11428,8 +11388,6 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
{
if (CreateVehicleKit(VehicleId, creatureEntry))
{
- GetVehicleKit()->Reset();
-
// Send others that we now have a vehicle
WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size()+4);
data.appendPackGUID(GetGUID());
@@ -14276,7 +14234,7 @@ void Unit::StopMoving()
return;
Movement::MoveSplineInit init(this);
- init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset());
+ init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset(), false);
init.SetFacing(GetOrientation());
init.Launch();
}
@@ -15296,15 +15254,32 @@ void Unit::SetControlled(bool apply, UnitState state)
{
switch (state)
{
- case UNIT_STATE_STUNNED: if (HasAuraType(SPELL_AURA_MOD_STUN)) return;
- else SetStunned(false); break;
- case UNIT_STATE_ROOT: if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle()) return;
- else SetRooted(false); break;
- case UNIT_STATE_CONFUSED:if (HasAuraType(SPELL_AURA_MOD_CONFUSE)) return;
- else SetConfused(false); break;
- case UNIT_STATE_FLEEING: if (HasAuraType(SPELL_AURA_MOD_FEAR)) return;
- else SetFeared(false); break;
- default: return;
+ case UNIT_STATE_STUNNED:
+ if (HasAuraType(SPELL_AURA_MOD_STUN))
+ return;
+
+ SetStunned(false);
+ break;
+ case UNIT_STATE_ROOT:
+ if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle())
+ return;
+
+ SetRooted(false);
+ break;
+ case UNIT_STATE_CONFUSED:
+ if (HasAuraType(SPELL_AURA_MOD_CONFUSE))
+ return;
+
+ SetConfused(false);
+ break;
+ case UNIT_STATE_FLEEING:
+ if (HasAuraType(SPELL_AURA_MOD_FEAR))
+ return;
+
+ SetFeared(false);
+ break;
+ default:
+ return;
}
ClearUnitState(state);
@@ -15481,7 +15456,10 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
// dismount players when charmed
if (GetTypeId() == TYPEID_PLAYER)
- Dismount();
+ RemoveAurasByType(SPELL_AURA_MOUNTED);
+
+ if (charmer->GetTypeId() == TYPEID_PLAYER)
+ charmer->RemoveAurasByType(SPELL_AURA_MOUNTED);
ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle());
@@ -16604,31 +16582,10 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
{
if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->isInCombat())
return;
-
- InterruptNonMeleeSpells(false);
- player->StopCastingCharm();
- player->StopCastingBindSight();
- Dismount();
- RemoveAurasByType(SPELL_AURA_MOUNTED);
-
- // drop flag at invisible in bg
- if (Battleground* bg = player->GetBattleground())
- bg->EventPlayerDroppedFlag(player);
-
- WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- player->GetSession()->SendPacket(&data);
-
- player->UnsummonPetTemporaryIfAny();
}
ASSERT(!m_vehicle);
- m_vehicle = vehicle;
-
- if (!m_vehicle->AddPassenger(this, seatId))
- {
- m_vehicle = NULL;
- return;
- }
+ (void)vehicle->AddPassenger(this, seatId);
}
void Unit::ChangeSeat(int8 seatId, bool next)
@@ -16636,17 +16593,24 @@ void Unit::ChangeSeat(int8 seatId, bool next)
if (!m_vehicle)
return;
- if (seatId < 0)
- {
- seatId = m_vehicle->GetNextEmptySeat(GetTransSeat(), next);
- if (seatId < 0)
- return;
- }
- else if (seatId == GetTransSeat() || !m_vehicle->HasEmptySeat(seatId))
+ // Don't change if current and new seat are identical
+ if (seatId == GetTransSeat())
return;
+ SeatMap::const_iterator seat = (seatId < 0 ? m_vehicle->GetNextEmptySeat(GetTransSeat(), next) : m_vehicle->Seats.find(seatId));
+ // The second part of the check will only return true if seatId >= 0. @Vehicle::GetNextEmptySeat makes sure of that.
+ if (seat == m_vehicle->Seats.end() || seat->second.Passenger)
+ return;
+
+ // Todo: the functions below could be consolidated and refactored to take
+ // SeatMap::const_iterator as parameter, to save redundant map lookups.
m_vehicle->RemovePassenger(this);
- if (!m_vehicle->AddPassenger(this, seatId))
+
+ // Set m_vehicle to NULL before adding passenger as adding new passengers is handled asynchronously
+ // and someone may call ExitVehicle again before passenger is added to new seat
+ Vehicle* veh = m_vehicle;
+ m_vehicle = NULL;
+ if (!veh->AddPassenger(this, seatId))
ASSERT(false);
}
@@ -16671,6 +16635,9 @@ void Unit::ExitVehicle(Position const* /*exitPosition*/)
void Unit::_ExitVehicle(Position const* exitPosition)
{
+ /// It's possible m_vehicle is NULL, when this function is called indirectly from @VehicleJoinEvent::Abort.
+ /// In that case it was not possible to add the passenger to the vehicle. The vehicle aura has already been removed
+ /// from the target in the aforementioned function and we don't need to do anything else at this point.
if (!m_vehicle)
return;
@@ -17145,7 +17112,7 @@ void Unit::SetInFront(Unit const* target)
void Unit::SetFacingTo(float ori)
{
Movement::MoveSplineInit init(this);
- init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset());
+ init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset(), false);
init.SetFacing(ori);
init.Launch();
}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 1a41c25d97c..b549802c91c 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -332,6 +332,7 @@ class UnitAI;
class Totem;
class Transport;
class Vehicle;
+class VehicleJoinEvent;
class TransportBase;
class SpellCastTargets;
@@ -397,6 +398,7 @@ enum TriggerCastFlags
TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
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_FULL_MASK = 0xFFFFFFFF
};
@@ -2183,6 +2185,7 @@ class Unit : public WorldObject
uint32 GetRedirectThreatPercent() { return _redirectThreadInfo.GetThreatPct(); }
Unit* GetRedirectThreatTarget() { return _redirectThreadInfo.GetTargetGUID() ? GetUnit(*this, _redirectThreadInfo.GetTargetGUID()) : NULL; }
+ friend class VehicleJoinEvent;
bool IsAIEnabled, NeedChangeAI;
bool CreateVehicleKit(uint32 id, uint32 creatureEntry);
void RemoveVehicleKit();
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 8f040ab6a5e..f3844d96069 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -30,9 +30,12 @@
#include "SpellInfo.h"
#include "MoveSplineInit.h"
#include "TemporarySummon.h"
+#include "EventProcessor.h"
+#include "Player.h"
+#include "Battleground.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) :
-_me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry), _status(STATUS_NONE)
+UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE)
{
for (uint32 i = 0; i < MAX_VEHICLE_SEATS; ++i)
{
@@ -41,10 +44,16 @@ _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntr
{
Seats.insert(std::make_pair(i, VehicleSeat(veSeat)));
if (veSeat->CanEnterOrExit())
- ++_usableSeatNum;
+ ++UsableSeatNum;
}
}
+ // Set or remove correct flags based on available seats. Will overwrite db data (if wrong).
+ if (UsableSeatNum)
+ _me->SetFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
+ else
+ _me->RemoveFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
+
InitMovementInfoForBase();
}
@@ -56,6 +65,15 @@ Vehicle::~Vehicle()
ASSERT(!itr->second.Passenger);
}
+/**
+ * @fn void Vehicle::Install()
+ *
+ * @brief Initializes power type for vehicle. Nothing more.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ */
+
void Vehicle::Install()
{
if (Creature* creature = _me->ToCreature())
@@ -114,15 +132,26 @@ void Vehicle::InstallAllAccessories(bool evading)
InstallAccessory(itr->AccessoryEntry, itr->SeatId, itr->IsMinion, itr->SummonedType, itr->SummonTime);
}
+/**
+ * @fn void Vehicle::Uninstall()
+ *
+ * @brief Removes all passengers and sets status to STATUS_UNINSTALLING.
+ * No new passengers can be added to the vehicle after this call.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ */
+
void Vehicle::Uninstall()
{
/// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
- if (_status == STATUS_UNINSTALLING)
+ if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
{
sLog->outError(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry());
return;
}
+
_status = STATUS_UNINSTALLING;
sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow());
RemoveAllPassengers();
@@ -131,26 +160,39 @@ void Vehicle::Uninstall()
sScriptMgr->OnUninstall(this);
}
+/**
+ * @fn void Vehicle::Reset(bool evading )
+ *
+ * @brief Reapplies immunities and reinstalls accessories. Only has effect for creatures.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param evading true if called from CreatureAI::EnterEvadeMode
+ */
+
void Vehicle::Reset(bool evading /*= false*/)
{
- sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Reset Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow());
- if (_me->GetTypeId() == TYPEID_PLAYER)
- {
- if (_usableSeatNum)
- _me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
- }
- else
- {
- ApplyAllImmunities();
- InstallAllAccessories(evading);
- if (_usableSeatNum)
- _me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- }
+ if (GetBase()->GetTypeId() != TYPEID_UNIT)
+ return;
- if (GetBase()->GetTypeId() == TYPEID_UNIT)
- sScriptMgr->OnReset(this);
+ sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Reset (Entry: %u, GuidLow: %u, DBGuid: %u)", GetCreatureEntry(), _me->GetGUIDLow(), _me->ToCreature()->GetDBTableGUIDLow());
+
+ ApplyAllImmunities();
+ InstallAllAccessories(evading);
+
+ sScriptMgr->OnReset(this);
}
+/**
+ * @fn void Vehicle::ApplyAllImmunities()
+ *
+ * @brief Applies specific immunities that cannot be set in DB.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ */
+
void Vehicle::ApplyAllImmunities()
{
// This couldn't be done in DB, because some spells have MECHANIC_NONE
@@ -199,10 +241,28 @@ void Vehicle::ApplyAllImmunities()
}
}
+/**
+ * @fn void Vehicle::RemoveAllPassengers()
+ *
+ * @brief Removes all current and pending passengers from the vehicle.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ */
+
void Vehicle::RemoveAllPassengers()
{
sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::RemoveAllPassengers. Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow());
+ /// Setting to_Abort to true will cause @VehicleJoinEvent::Abort to be executed on next @Unit::UpdateEvents call
+ /// This will properly "reset" the pending join process for the passenger.
+ while (!_pendingJoinEvents.empty())
+ {
+ VehicleJoinEvent* e = _pendingJoinEvents.front();
+ e->to_Abort = true;
+ _pendingJoinEvents.pop_front();
+ }
+
// Passengers always cast an aura with SPELL_AURA_CONTROL_VEHICLE on the vehicle
// We just remove the aura and the unapply handler will make the target leave the vehicle.
// We don't need to iterate over Seats
@@ -215,6 +275,19 @@ void Vehicle::RemoveAllPassengers()
// ASSERT(!itr->second.passenger);
}
+/**
+ * @fn bool Vehicle::HasEmptySeat(int8 seatId) const
+ *
+ * @brief Checks if vehicle's seat specified by 'seatId' is empty.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param seatId Identifier for the seat.
+ *
+ * @return true if empty seat, false if not.
+ */
+
bool Vehicle::HasEmptySeat(int8 seatId) const
{
SeatMap::const_iterator seat = Seats.find(seatId);
@@ -223,6 +296,19 @@ bool Vehicle::HasEmptySeat(int8 seatId) const
return !seat->second.Passenger;
}
+/**
+ * @fn Unit* Vehicle::GetPassenger(int8 seatId) const
+ *
+ * @brief Gets a passenger on specified seat.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param seatId Seat to look on.
+ *
+ * @return null if it not found, else pointer to passenger if in world
+ */
+
Unit* Vehicle::GetPassenger(int8 seatId) const
{
SeatMap::const_iterator seat = Seats.find(seatId);
@@ -232,92 +318,127 @@ Unit* Vehicle::GetPassenger(int8 seatId) const
return ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger);
}
-int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
+/**
+ * @fn SeatMap::const_iterator Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
+ *
+ * @brief Gets the next empty seat based on current seat.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param seatId Identifier for the current seat.
+ * @param next true if iterating forward, false means iterating backwards.
+ *
+ * @return The next empty seat.
+ */
+
+SeatMap::const_iterator Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
{
SeatMap::const_iterator seat = Seats.find(seatId);
if (seat == Seats.end())
- return -1;
+ return seat;
while (seat->second.Passenger || (!seat->second.SeatInfo->CanEnterOrExit() && !seat->second.SeatInfo->IsUsableByOverride()))
{
if (next)
{
- ++seat;
- if (seat == Seats.end())
+ if (++seat == Seats.end())
seat = Seats.begin();
}
else
{
- if (seat == Seats.begin())
+ if (seat-- == Seats.begin())
seat = Seats.end();
- --seat;
}
+ // Make sure we don't loop indefinetly
if (seat->first == seatId)
- return -1; // no available seat
+ return Seats.end();
}
- return seat->first;
+ return seat;
}
+/**
+ * @fn void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type,
+ * uint32 summonTime)
+ *
+ * @brief Installs an accessory.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param entry The NPC entry of accessory.
+ * @param seatId Identifier for the seat to add the accessory to.
+ * @param minion true if accessory considered a 'minion'. Implies that the accessory will despawn when the vehicle despawns.
+ * Essentially that it has no life without the vehicle. Their fates are bound.
+ * @param type See enum @SummonType.
+ * @param summonTime Time after which the minion is despawned in case of a timed despawn @type specified.
+ */
+
void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime)
{
/// @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
if (_status == STATUS_UNINSTALLING)
{
- sLog->outError(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! "
- "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry(), entry, (int32)seatId);
+ sLog->outError(LOG_FILTER_VEHICLES, "Vehicle (GuidLow: %u, DB GUID: %u, Entry: %u) attempts to install accessory (Entry: %u) on seat %i with STATUS_UNINSTALLING! "
+ "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(),
+ (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : _me->GetGUIDLow()), GetCreatureEntry(), entry, (int32)seatId);
return;
}
- sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle: Installing accessory entry %u on vehicle entry %u (seat:%i)", entry, GetCreatureEntry(), seatId);
- if (Unit* passenger = GetPassenger(seatId))
- {
- // already installed
- if (passenger->GetEntry() == entry)
- {
- ASSERT(passenger->GetTypeId() == TYPEID_UNIT);
- if (_me->GetTypeId() == TYPEID_UNIT)
- {
- if (_me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
- passenger->ToCreature()->AI()->EnterEvadeMode();
- return;
- }
- }
- else
- passenger->ExitVehicle(); // this should not happen
- }
+ sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle (GuidLow: %u, DB Guid: %u, Entry %u): installing accessory (Entry: %u) on seat: %i",
+ _me->GetGUIDLow(), (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : _me->GetGUIDLow()), GetCreatureEntry(),
+ entry, (int32)seatId);
- if (TempSummon* accessory = _me->SummonCreature(entry, *_me, TempSummonType(type), summonTime))
- {
- if (minion)
- accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
+ TempSummon* accessory = _me->SummonCreature(entry, *_me, TempSummonType(type), summonTime);
+ ASSERT(accessory);
- if (!_me->HandleSpellClick(accessory, seatId))
- {
- accessory->UnSummon();
- return;
- }
+ if (minion)
+ accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
- if (GetBase()->GetTypeId() == TYPEID_UNIT)
- sScriptMgr->OnInstallAccessory(this, accessory);
- }
+ (void)_me->HandleSpellClick(accessory, seatId);
+
+ /// If for some reason adding accessory to vehicle fails it will unsummon in
+ /// @VehicleJoinEvent::Abort
}
+/**
+ * @fn bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
+ *
+ * @brief Attempts to add a passenger to the vehicle on 'seatId'.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param [in,out] The prospective passenger.
+ * @param seatId Identifier for the seat. Value of -1 indicates the next available seat.
+ *
+ * @return true if it succeeds, false if it fails.
+ */
+
bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
{
/// @Prevent adding passengers when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
if (_status == STATUS_UNINSTALLING)
{
- sLog->outError(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, attempting to board vehicle GuidLow: %u, Entry: %u during uninstall! SeatId: %i",
+ sLog->outError(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, attempting to board vehicle GuidLow: %u, Entry: %u during uninstall! SeatId: %d",
unit->GetGUIDLow(), unit->GetEntry(), _me->GetGUIDLow(), _me->GetEntry(), (int32)seatId);
return false;
}
- if (unit->GetVehicle() != this)
- return false;
+ sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s scheduling enter vehicle (entry: %u, vehicleId: %u, guid: %u (dbguid: %u) on seat %d",
+ unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(),
+ (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : 0), (int32)seatId);
+ // The seat selection code may kick other passengers off the vehicle.
+ // While the validity of the following may be arguable, it is possible that when such a passenger
+ // exits the vehicle will dismiss. That's why the actual adding the passenger to the vehicle is scheduled
+ // asynchronously, so it can be cancelled easily in case the vehicle is uninstalled meanwhile.
SeatMap::iterator seat;
+ VehicleJoinEvent* e = new VehicleJoinEvent(this, unit);
+ unit->m_Events.AddEvent(e, unit->m_Events.CalculateTime(0));
+
if (seatId < 0) // no specific seat requirement
{
for (seat = Seats.begin(); seat != Seats.end(); ++seat)
@@ -325,87 +446,49 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
break;
if (seat == Seats.end()) // no available seat
+ {
+ e->to_Abort = true;
return false;
+ }
+
+ e->Seat = seat;
+ _pendingJoinEvents.push_back(e);
}
else
{
seat = Seats.find(seatId);
if (seat == Seats.end())
+ {
+ e->to_Abort = true;
return false;
+ }
+ e->Seat = seat;
+ _pendingJoinEvents.push_back(e);
if (seat->second.Passenger)
{
- if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger))
- passenger->ExitVehicle();
- else
- seat->second.Passenger = 0;
+ Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger);
+ ASSERT(passenger);
+ passenger->ExitVehicle();
}
ASSERT(!seat->second.Passenger);
}
- 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);
-
- seat->second.Passenger = unit->GetGUID();
- if (seat->second.SeatInfo->CanEnterOrExit())
- {
- ASSERT(_usableSeatNum);
- --_usableSeatNum;
- if (!_usableSeatNum)
- {
- if (_me->GetTypeId() == TYPEID_PLAYER)
- _me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
- else
- _me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- }
- }
-
- if (seat->second.SeatInfo->m_flags && !(seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING))
- unit->AddUnitState(UNIT_STATE_ONVEHICLE);
-
- unit->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
- VehicleSeatEntry const* veSeat = seat->second.SeatInfo;
- unit->m_movementInfo.t_pos.m_positionX = veSeat->m_attachmentOffsetX;
- unit->m_movementInfo.t_pos.m_positionY = veSeat->m_attachmentOffsetY;
- unit->m_movementInfo.t_pos.m_positionZ = veSeat->m_attachmentOffsetZ;
- unit->m_movementInfo.t_pos.SetOrientation(0);
- unit->m_movementInfo.t_time = 0; // 1 for player
- unit->m_movementInfo.t_seat = seat->first;
- unit->m_movementInfo.t_guid = _me->GetGUID();
-
- if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER &&
- seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
- ASSERT(_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
-
- if (_me->IsInWorld())
- {
- unit->SendClearTarget(); // SMSG_BREAK_TARGET
- unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
- // also adds MOVEMENTFLAG_ROOT
- Movement::MoveSplineInit init(unit);
- init.DisableTransportPathTransformations();
- init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
- init.SetFacing(0.0f);
- init.SetTransportEnter();
- init.Launch();
-
- if (_me->GetTypeId() == TYPEID_UNIT)
- {
- if (_me->ToCreature()->IsAIEnabled)
- _me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, true);
-
- // update all passenger's positions
- //Passenger's spline OR vehicle movement will update positions
- //RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation());
- }
- }
-
- if (GetBase()->GetTypeId() == TYPEID_UNIT)
- sScriptMgr->OnAddPassenger(this, unit, seatId);
-
return true;
}
+/**
+ * @fn void Vehicle::RemovePassenger(Unit* unit)
+ *
+ * @brief Removes the passenger from the vehicle.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param [in,out] unit The passenger to remove.
+ */
+
void Vehicle::RemovePassenger(Unit* unit)
{
if (unit->GetVehicle() != this)
@@ -414,20 +497,12 @@ void Vehicle::RemovePassenger(Unit* unit)
SeatMap::iterator seat = GetSeatIteratorForPassenger(unit);
ASSERT(seat != Seats.end());
- 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);
+ 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);
seat->second.Passenger = 0;
- if (seat->second.SeatInfo->CanEnterOrExit())
- {
- if (!_usableSeatNum)
- {
- if (_me->GetTypeId() == TYPEID_PLAYER)
- _me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
- else
- _me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- }
- ++_usableSeatNum;
- }
+ if (seat->second.SeatInfo->CanEnterOrExit() && ++UsableSeatNum)
+ _me->SetFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
unit->ClearUnitState(UNIT_STATE_ONVEHICLE);
@@ -437,7 +512,7 @@ void Vehicle::RemovePassenger(Unit* unit)
if (_me->IsInWorld())
{
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
- unit->m_movementInfo.t_pos.Relocate(0, 0, 0, 0);
+ unit->m_movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
unit->m_movementInfo.t_time = 0;
unit->m_movementInfo.t_seat = 0;
}
@@ -453,7 +528,15 @@ void Vehicle::RemovePassenger(Unit* unit)
sScriptMgr->OnRemovePassenger(this, unit);
}
-//! Must be called after m_base::Relocate
+/**
+ * @fn void Vehicle::RelocatePassengers()
+ *
+ * @brief Relocate passengers. Must be called after m_base::Relocate
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ */
+
void Vehicle::RelocatePassengers()
{
ASSERT(_me->GetMap());
@@ -473,16 +556,34 @@ void Vehicle::RelocatePassengers()
}
}
+/**
+ * @fn void Vehicle::Dismiss()
+ *
+ * @brief Dismiss the vehicle. Removes passengers and despawns self. Only valid for creatures.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ */
+
void Vehicle::Dismiss()
{
if (GetBase()->GetTypeId() != TYPEID_UNIT)
return;
- sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Dismiss Entry: %u, GuidLow %u", _creatureEntry, _me->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Dismiss Entry: %u, GuidLow %u, DBGuid: %u", GetCreatureEntry(), _me->GetGUIDLow(), _me->ToCreature()->GetDBTableGUIDLow());
Uninstall();
GetBase()->ToCreature()->DespawnOrUnsummon();
}
+/**
+ * @fn void Vehicle::InitMovementInfoForBase()
+ *
+ * @brief Sets correct MovementFlags2 based on VehicleFlags from DBC.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ */
+
void Vehicle::InitMovementInfoForBase()
{
uint32 vehicleFlags = GetVehicleInfo()->m_flags;
@@ -499,6 +600,19 @@ void Vehicle::InitMovementInfoForBase()
_me->AddExtraUnitMovementFlag(MOVEMENTFLAG2_FULL_SPEED_PITCHING);
}
+/**
+ * @fn VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit* passenger)
+ *
+ * @brief Returns information on the seat of specified passenger, represented by the format in VehicleSeat.dbc
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param [in,out] The passenger for which we check the seat info.
+ *
+ * @return null if passenger not found on vehicle, else the DBC record for the seat.
+ */
+
VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit* passenger)
{
SeatMap::iterator itr;
@@ -509,6 +623,19 @@ VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit* passenger)
return NULL;
}
+/**
+ * @fn SeatMap::iterator Vehicle::GetSeatIteratorForPassenger(Unit* passenger)
+ *
+ * @brief Gets seat iterator for specified passenger.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param [in,out] passenger Passenger to look up.
+ *
+ * @return The seat iterator for specified passenger if it's found on the vehicle. Otherwise Seats.end() (invalid iterator).
+ */
+
SeatMap::iterator Vehicle::GetSeatIteratorForPassenger(Unit* passenger)
{
SeatMap::iterator itr;
@@ -519,6 +646,17 @@ SeatMap::iterator Vehicle::GetSeatIteratorForPassenger(Unit* passenger)
return Seats.end();
}
+/**
+ * @fn uint8 Vehicle::GetAvailableSeatCount() const
+ *
+ * @brief Gets the available seat count.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @return The available seat count.
+ */
+
uint8 Vehicle::GetAvailableSeatCount() const
{
uint8 ret = 0;
@@ -549,3 +687,175 @@ void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
}
+
+/**
+ * @fn void Vehicle::RemovePendingEvent(VehicleJoinEvent* e)
+ *
+ * @brief Removes @VehicleJoinEvent objects from pending join event store.
+ * This method only removes it after it's executed or aborted to prevent leaving
+ * pointers to deleted events.
+ *
+ * @author Shauren
+ * @date 22-2-2013
+ *
+ * @param [in] e The VehicleJoinEvent* to remove from pending event store.
+ */
+
+void Vehicle::RemovePendingEvent(VehicleJoinEvent* e)
+{
+ for (PendingJoinEventContainer::iterator itr = _pendingJoinEvents.begin(); itr != _pendingJoinEvents.end(); ++itr)
+ {
+ if (*itr == e)
+ {
+ _pendingJoinEvents.erase(itr);
+ break;
+ }
+ }
+}
+
+/**
+ * @fn void Vehicle::RemovePendingEventsForSeat(uint8 seatId)
+ *
+ * @brief Removes any pending events for given seatId. Executed when a @VehicleJoinEvent::Execute is called
+ *
+ * @author Machiavelli
+ * @date 23-2-2013
+ *
+ * @param seatId Identifier for the seat.
+ */
+
+void Vehicle::RemovePendingEventsForSeat(int8 seatId)
+{
+ for (PendingJoinEventContainer::iterator itr = _pendingJoinEvents.begin(); itr != _pendingJoinEvents.end();)
+ {
+ if ((*itr)->Seat->first == seatId)
+ {
+ (*itr)->to_Abort = true;
+ _pendingJoinEvents.erase(itr++);
+ }
+ else
+ ++itr;
+ }
+}
+
+/**
+ * @fn bool VehicleJoinEvent::Execute(uint64, uint32)
+ *
+ * @brief Actually adds the passenger @Passenger to vehicle @Target.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param parameter1 Unused
+ * @param parameter2 Unused.
+ *
+ * @return true, cannot fail.
+ *
+ */
+
+bool VehicleJoinEvent::Execute(uint64, uint32)
+{
+ ASSERT(Passenger->IsInWorld());
+ ASSERT(Target->GetBase()->IsInWorld());
+
+ Target->RemovePendingEventsForSeat(Seat->first);
+
+ Passenger->m_vehicle = Target;
+ Seat->second.Passenger = Passenger->GetGUID();
+ if (Seat->second.SeatInfo->CanEnterOrExit())
+ {
+ ASSERT(Target->UsableSeatNum);
+ --(Target->UsableSeatNum);
+ if (!Target->UsableSeatNum)
+ {
+ if (Target->GetBase()->GetTypeId() == TYPEID_PLAYER)
+ Target->GetBase()->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
+ else
+ Target->GetBase()->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+ }
+ }
+
+ Passenger->InterruptNonMeleeSpells(false);
+ Passenger->RemoveAurasByType(SPELL_AURA_MOUNTED);
+
+ Player* player = Passenger->ToPlayer();
+ if (player)
+ {
+ // drop flag
+ if (Battleground* bg = player->GetBattleground())
+ bg->EventPlayerDroppedFlag(player);
+
+ player->StopCastingCharm();
+ player->StopCastingBindSight();
+ player->SendOnCancelExpectedVehicleRideAura();
+ player->UnsummonPetTemporaryIfAny();
+ }
+
+ if (Seat->second.SeatInfo->m_flags && !(Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING))
+ Passenger->AddUnitState(UNIT_STATE_ONVEHICLE);
+
+ Passenger->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
+ VehicleSeatEntry const* veSeat = Seat->second.SeatInfo;
+ Passenger->m_movementInfo.t_pos.Relocate(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
+ Passenger->m_movementInfo.t_time = 0; // 1 for player
+ Passenger->m_movementInfo.t_seat = Seat->first;
+ Passenger->m_movementInfo.t_guid = Target->GetBase()->GetGUID();
+
+ if (Target->GetBase()->GetTypeId() == TYPEID_UNIT && Passenger->GetTypeId() == TYPEID_PLAYER &&
+ Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
+ ASSERT(Target->GetBase()->SetCharmedBy(Passenger, CHARM_TYPE_VEHICLE)) // SMSG_CLIENT_CONTROL
+
+ Passenger->SendClearTarget(); // SMSG_BREAK_TARGET
+ Passenger->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
+ // also adds MOVEMENTFLAG_ROOT
+
+ Movement::MoveSplineInit init(Passenger);
+ init.DisableTransportPathTransformations();
+ init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ, false, true);
+ init.SetFacing(0.0f);
+ init.SetTransportEnter();
+ init.Launch();
+
+ if (Target->GetBase()->GetTypeId() == TYPEID_UNIT)
+ {
+ if (Target->GetBase()->ToCreature()->IsAIEnabled)
+ Target->GetBase()->ToCreature()->AI()->PassengerBoarded(Passenger, Seat->first, true);
+
+ sScriptMgr->OnAddPassenger(Target, Passenger, Seat->first);
+
+ // Actually quite a redundant hook. Could just use OnAddPassenger and check for unit typemask inside script.
+ if (Passenger->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
+ sScriptMgr->OnInstallAccessory(Target, Passenger->ToCreature());
+
+ // update all passenger's positions
+ //Passenger's spline OR vehicle movement will update positions
+ //RelocatePassengers(_me->GetPositionX(), _me->GetPositionY(), _me->GetPositionZ(), _me->GetOrientation());
+ }
+
+ return true;
+}
+
+/**
+ * @fn void VehicleJoinEvent::Abort(uint64)
+ *
+ * @brief Aborts the event. Implies that unit @Passenger will not be boarding vehicle @Target after all.
+ *
+ * @author Machiavelli
+ * @date 17-2-2013
+ *
+ * @param parameter1 Unused
+ */
+
+void VehicleJoinEvent::Abort(uint64)
+{
+ sLog->outDebug(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, board on vehicle GuidLow: %u, Entry: %u SeatId: %i cancelled",
+ Passenger->GetGUIDLow(), Passenger->GetEntry(), Target->GetBase()->GetGUIDLow(), Target->GetBase()->GetEntry(), (int32)Seat->first);
+
+ /// @SPELL_AURA_CONTROL_VEHICLE auras can be applied even when the passenger is not (yet) on the vehicle.
+ /// When this code is triggered it means that something went wrong in @Vehicle::AddPassenger, and we should remove
+ /// the aura manually.
+ Target->GetBase()->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, Passenger->GetGUID());
+
+ if (Passenger->IsInWorld() && Passenger->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
+ Passenger->ToCreature()->DespawnOrUnsummon();
+}
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 823fb72b8a8..8b67b82cfa3 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -23,15 +23,23 @@
#include "Object.h"
#include "VehicleDefines.h"
#include "Unit.h"
+#include <list>
struct VehicleEntry;
-
class Unit;
+class VehicleJoinEvent;
typedef std::set<uint64> GuidSet;
class Vehicle : public TransportBase
{
+ protected:
+ friend bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry);
+ Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
+
+ friend void Unit::RemoveVehicleKit();
+ ~Vehicle();
+
public:
void Install();
void Uninstall();
@@ -46,7 +54,7 @@ class Vehicle : public TransportBase
bool HasEmptySeat(int8 seatId) const;
Unit* GetPassenger(int8 seatId) const;
- int8 GetNextEmptySeat(int8 seatId, bool next) const;
+ SeatMap::const_iterator GetNextEmptySeat(int8 seatId, bool next) const;
uint8 GetAvailableSeatCount() const;
bool AddPassenger(Unit* passenger, int8 seatId = -1);
@@ -55,21 +63,18 @@ class Vehicle : public TransportBase
void RelocatePassengers();
void RemoveAllPassengers();
void Dismiss();
- void TeleportVehicle(float x, float y, float z, float ang);
bool IsVehicleInUse() { return Seats.begin() != Seats.end(); }
- void SetLastShootPos(Position const& pos) { m_lastShootPos.Relocate(pos); }
- Position GetLastShootPos() { return m_lastShootPos; }
+ void SetLastShootPos(Position const& pos) { _lastShootPos.Relocate(pos); }
+ Position GetLastShootPos() { return _lastShootPos; }
- SeatMap Seats;
+ SeatMap Seats; ///< The collection of all seats on the vehicle. Including vacant ones.
VehicleSeatEntry const* GetSeatForPassenger(Unit* passenger);
protected:
- friend bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry);
- Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
- friend void Unit::RemoveVehicleKit();
- ~Vehicle();
+ friend class VehicleJoinEvent;
+ uint32 UsableSeatNum; ///< Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
private:
enum Status
@@ -88,12 +93,34 @@ class Vehicle : public TransportBase
/// This method transforms supplied global coordinates into local offsets
void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
- Unit* _me;
- VehicleEntry const* _vehicleInfo;
+ void RemovePendingEvent(VehicleJoinEvent* e);
+ void RemovePendingEventsForSeat(int8 seatId);
+
+ private:
+ Unit* _me; ///< The underlying unit with the vehicle kit. Can be player or creature.
+ VehicleEntry const* _vehicleInfo; ///< DBC data for vehicle
GuidSet vehiclePlayers;
- uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
- uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players
- Status _status;
- Position m_lastShootPos;
+
+ uint32 _creatureEntry; ///< Can be different than the entry of _me in case of players
+ Status _status; ///< Internal variable for sanity checks
+ Position _lastShootPos;
+
+ typedef std::list<VehicleJoinEvent*> PendingJoinEventContainer;
+ PendingJoinEventContainer _pendingJoinEvents; ///< Collection of delayed join events for prospective passengers
};
+
+class VehicleJoinEvent : public BasicEvent
+{
+ friend class Vehicle;
+ protected:
+ VehicleJoinEvent(Vehicle* v, Unit* u) : Target(v), Passenger(u), Seat(Target->Seats.end()) {}
+ ~VehicleJoinEvent() { Target->RemovePendingEvent(this); }
+ bool Execute(uint64, uint32);
+ void Abort(uint64);
+
+ Vehicle* Target;
+ Unit* Passenger;
+ SeatMap::iterator Seat;
+};
+
#endif
diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h
index 3d3b43e832c..4210a663aab 100644
--- a/src/server/game/Entities/Vehicle/VehicleDefines.h
+++ b/src/server/game/Entities/Vehicle/VehicleDefines.h
@@ -78,6 +78,8 @@ typedef std::map<int8, VehicleSeat> SeatMap;
class TransportBase
{
public:
+ virtual ~TransportBase() { }
+
/// This method transforms supplied transport offsets into global coordinates
virtual void CalculatePassengerPosition(float& x, float& y, float& z, float& o) = 0;
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index a499347356b..89ce8108b6e 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -210,8 +210,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
mGameEvent.clear();
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 game events. DB table `game_event` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game events. DB table `game_event` is empty.");
return;
}
@@ -451,8 +450,8 @@ void GameEventMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT creature.guid, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id "
+ // 0 1 2 3 4
+ QueryResult result = WorldDatabase.Query("SELECT creature.guid, creature.id, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id "
"FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid");
if (!result)
@@ -467,7 +466,8 @@ void GameEventMgr::LoadFromDB()
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
- uint16 event_id = fields[1].GetUInt8();
+ uint32 entry = fields[1].GetUInt32();
+ uint16 event_id = fields[2].GetUInt8();
if (event_id >= mGameEventModelEquip.size())
{
@@ -477,17 +477,18 @@ void GameEventMgr::LoadFromDB()
ModelEquipList& equiplist = mGameEventModelEquip[event_id];
ModelEquip newModelEquipSet;
- newModelEquipSet.modelid = fields[2].GetUInt32();
- newModelEquipSet.equipment_id = fields[3].GetUInt32();
+ newModelEquipSet.modelid = fields[3].GetUInt32();
+ newModelEquipSet.equipment_id = fields[4].GetUInt8();
newModelEquipSet.equipement_id_prev = 0;
newModelEquipSet.modelid_prev = 0;
if (newModelEquipSet.equipment_id > 0)
{
- if (!sObjectMgr->GetEquipmentInfo(newModelEquipSet.equipment_id))
+ int8 equipId = static_cast<int8>(newModelEquipSet.equipment_id);
+ if (!sObjectMgr->GetEquipmentInfo(entry, equipId))
{
- sLog->outError(LOG_FILTER_SQL, "Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
- guid, newModelEquipSet.equipment_id);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_event_model_equip` have creature (Guid: %u, entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
+ guid, entry, newModelEquipSet.equipment_id);
continue;
}
}
@@ -1103,14 +1104,8 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
void GameEventMgr::ApplyNewEvent(uint16 event_id)
{
- switch (sWorld->getIntConfig(CONFIG_EVENT_ANNOUNCE))
- {
- case 0: // disable
- break;
- case 1: // announce events
- sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
- break;
- }
+ if (sWorld->getBoolConfig(CONFIG_EVENT_ANNOUNCE))
+ sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
@@ -1332,7 +1327,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
itr->second.equipement_id_prev = creature->GetCurrentEquipmentId();
itr->second.modelid_prev = creature->GetDisplayId();
creature->LoadEquipment(itr->second.equipment_id, true);
- if (itr->second.modelid >0 && itr->second.modelid_prev != itr->second.modelid)
+ if (itr->second.modelid > 0 && itr->second.modelid_prev != itr->second.modelid)
{
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(itr->second.modelid);
if (minfo)
@@ -1347,7 +1342,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
else
{
creature->LoadEquipment(itr->second.equipement_id_prev, true);
- if (itr->second.modelid_prev >0 && itr->second.modelid_prev != itr->second.modelid)
+ if (itr->second.modelid_prev > 0 && itr->second.modelid_prev != itr->second.modelid)
{
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(itr->second.modelid_prev);
if (minfo)
@@ -1370,7 +1365,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
sObjectMgr->GetCreatureModelRandomGender(&displayID);
if (data2->equipmentId == 0)
- itr->second.equipement_id_prev = cinfo->equipmentId;
+ itr->second.equipement_id_prev = 0; ///@todo: verify this line
else if (data2->equipmentId != -1)
itr->second.equipement_id_prev = data->equipmentId;
itr->second.modelid_prev = displayID;
diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h
index d15b3e48dc9..4175e57f28a 100644
--- a/src/server/game/Events/GameEventMgr.h
+++ b/src/server/game/Events/GameEventMgr.h
@@ -73,9 +73,9 @@ struct GameEventData
struct ModelEquip
{
uint32 modelid;
- uint32 equipment_id;
uint32 modelid_prev;
- uint32 equipement_id_prev;
+ uint8 equipment_id;
+ uint8 equipement_id_prev;
};
struct NPCVendorEntry
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 891bc9b253a..222331c48f8 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -404,8 +404,8 @@ void ObjectMgr::LoadCreatureTemplates()
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
// 68 69 70 71 72 73 74 75 76 77 78
"InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, "
- // 79 80 81 82 83 84
- " questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName "
+ // 79 80 81 82 83 84
+ " questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName "
"FROM creature_template;");
if (!result)
@@ -500,10 +500,9 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.movementId = fields[80].GetUInt32();
creatureTemplate.RegenHealth = fields[81].GetBool();
- creatureTemplate.equipmentId = fields[82].GetUInt32();
- creatureTemplate.MechanicImmuneMask = fields[83].GetUInt32();
- creatureTemplate.flags_extra = fields[84].GetUInt32();
- creatureTemplate.ScriptID = GetScriptId(fields[85].GetCString());
+ creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32();
+ creatureTemplate.flags_extra = fields[83].GetUInt32();
+ creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString());
++count;
}
@@ -858,15 +857,6 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
}
- if (cInfo->equipmentId > 0) // 0 no equipment
- {
- if (!GetEquipmentInfo(cInfo->equipmentId))
- {
- sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with `equipment_id` %u not found in table `creature_equip_template`, set to no equipment.", cInfo->Entry, cInfo->equipmentId);
- const_cast<CreatureTemplate*>(cInfo)->equipmentId = 0;
- }
- }
-
/// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc
if (cInfo->scale <= 0.0f)
{
@@ -986,11 +976,28 @@ CreatureAddon const* ObjectMgr::GetCreatureTemplateAddon(uint32 entry)
return NULL;
}
-EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry)
+EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry, int8& id)
{
EquipmentInfoContainer::const_iterator itr = _equipmentInfoStore.find(entry);
- if (itr != _equipmentInfoStore.end())
- return &(itr->second);
+ if (itr == _equipmentInfoStore.end())
+ return NULL;
+
+ if (itr->second.empty())
+ return NULL;
+
+ if (id == -1) // select a random element
+ {
+ EquipmentInfoContainerInternal::const_iterator ritr = itr->second.begin();
+ std::advance(ritr, urand(0u, itr->second.size() - 1));
+ id = std::distance(itr->second.begin(), ritr) + 1;
+ return &ritr->second;
+ }
+ else
+ {
+ EquipmentInfoContainerInternal::const_iterator itr2 = itr->second.find(id);
+ if (itr2 != itr->second.end())
+ return &itr2->second;
+ }
return NULL;
}
@@ -999,7 +1006,8 @@ void ObjectMgr::LoadEquipmentTemplates()
{
uint32 oldMSTime = getMSTime();
- QueryResult result = WorldDatabase.Query("SELECT entry, itemEntry1, itemEntry2, itemEntry3 FROM creature_equip_template");
+ // 0 1 2 3 4
+ QueryResult result = WorldDatabase.Query("SELECT entry, id, itemEntry1, itemEntry2, itemEntry3 FROM creature_equip_template");
if (!result)
{
@@ -1012,13 +1020,21 @@ void ObjectMgr::LoadEquipmentTemplates()
{
Field* fields = result->Fetch();
- uint16 entry = fields[0].GetUInt16();
+ uint32 entry = fields[0].GetUInt32();
+
+ if (!sObjectMgr->GetCreatureTemplate(entry))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Creature template (Entry: %u) does not exist but has a record in `creature_equip_template`", entry);
+ continue;
+ }
+
+ uint8 id = fields[1].GetUInt8();
- EquipmentInfo& equipmentInfo = _equipmentInfoStore[entry];
+ EquipmentInfo& equipmentInfo = _equipmentInfoStore[entry][id];
- equipmentInfo.ItemEntry[0] = fields[1].GetUInt32();
- equipmentInfo.ItemEntry[1] = fields[2].GetUInt32();
- equipmentInfo.ItemEntry[2] = fields[3].GetUInt32();
+ equipmentInfo.ItemEntry[0] = fields[2].GetUInt32();
+ equipmentInfo.ItemEntry[1] = fields[3].GetUInt32();
+ equipmentInfo.ItemEntry[2] = fields[4].GetUInt32();
for (uint8 i = 0; i < MAX_EQUIPMENT_ITEMS; ++i)
{
@@ -1029,8 +1045,8 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!dbcItem)
{
- sLog->outError(LOG_FILTER_SQL, "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u, forced to 0.",
- equipmentInfo.ItemEntry[i], i+1, entry);
+ sLog->outError(LOG_FILTER_SQL, "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id=%u, forced to 0.",
+ equipmentInfo.ItemEntry[i], i+1, entry, id);
equipmentInfo.ItemEntry[i] = 0;
continue;
}
@@ -1045,8 +1061,8 @@ void ObjectMgr::LoadEquipmentTemplates()
dbcItem->InventoryType != INVTYPE_THROWN &&
dbcItem->InventoryType != INVTYPE_RANGEDRIGHT)
{
- sLog->outError(LOG_FILTER_SQL, "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u is not equipable in a hand, forced to 0.",
- equipmentInfo.ItemEntry[i], i+1, entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id = %u is not equipable in a hand, forced to 0.",
+ equipmentInfo.ItemEntry[i], i+1, entry, id);
equipmentInfo.ItemEntry[i] = 0;
}
}
@@ -1189,8 +1205,7 @@ void ObjectMgr::LoadLinkedRespawn()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty.");
return;
}
@@ -1406,6 +1421,92 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
return true;
}
+void ObjectMgr::LoadTempSummons()
+{
+ uint32 oldMSTime = getMSTime();
+
+ // 0 1 2 3 4 5 6 7 8 9
+ QueryResult result = WorldDatabase.Query("SELECT summonerId, summonerType, groupId, entry, position_x, position_y, position_z, orientation, summonType, summonTime FROM creature_summon_groups");
+
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 temp summons. DB table `creature_summon_groups` is empty.");
+ return;
+ }
+
+ uint32 count = 0;
+ do
+ {
+ Field* fields = result->Fetch();
+
+ uint32 summonerId = fields[0].GetUInt32();
+ SummonerType summonerType = SummonerType(fields[1].GetUInt8());
+ uint8 group = fields[2].GetUInt8();
+
+ switch (summonerType)
+ {
+ case SUMMONER_TYPE_CREATURE:
+ if (!GetCreatureTemplate(summonerId))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_summon_groups` has summoner with non existing entry %u for creature summoner type, skipped.", summonerId);
+ continue;
+ }
+ break;
+ case SUMMONER_TYPE_GAMEOBJECT:
+ if (!GetGameObjectTemplate(summonerId))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_summon_groups` has summoner with non existing entry %u for gameobject summoner type, skipped.", summonerId);
+ continue;
+ }
+ break;
+ case SUMMONER_TYPE_MAP:
+ if (!sMapStore.LookupEntry(summonerId))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_summon_groups` has summoner with non existing entry %u for map summoner type, skipped.", summonerId);
+ continue;
+ }
+ break;
+ default:
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_summon_groups` has unhandled summoner type %u for summoner %u, skipped.", summonerType, summonerId);
+ continue;
+ }
+
+ TempSummonData data;
+ data.entry = fields[3].GetUInt32();
+
+ if (!GetCreatureTemplate(data.entry))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_summon_groups` has creature in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] with non existing creature entry %u, skipped.", summonerId, summonerType, group, data.entry);
+ continue;
+ }
+
+ float posX = fields[4].GetFloat();
+ float posY = fields[5].GetFloat();
+ float posZ = fields[6].GetFloat();
+ float orientation = fields[7].GetFloat();
+
+ data.pos.Relocate(posX, posY, posZ, orientation);
+
+ data.type = TempSummonType(fields[8].GetUInt8());
+
+ if (data.type > TEMPSUMMON_MANUAL_DESPAWN)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_summon_groups` has unhandled temp summon type %u in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] for creature entry %u, skipped.", data.type, summonerId, summonerType, group, data.entry);
+ continue;
+ }
+
+ data.time = fields[9].GetUInt32();
+
+ TempSummonGroupKey key(summonerId, summonerType, group);
+ _tempSummonDataStore[key].push_back(data);
+
+ ++count;
+
+ } while (result->NextRow());
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u temp summons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
+
void ObjectMgr::LoadCreatures()
{
uint32 oldMSTime = getMSTime();
@@ -1420,8 +1521,7 @@ void ObjectMgr::LoadCreatures()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures. DB table `creature` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures. DB table `creature` is empty.");
return;
}
@@ -1453,7 +1553,7 @@ void ObjectMgr::LoadCreatures()
data.id = entry;
data.mapid = fields[2].GetUInt16();
data.displayid = fields[3].GetUInt32();
- data.equipmentId = fields[4].GetInt32();
+ data.equipmentId = fields[4].GetInt8();
data.posX = fields[5].GetFloat();
data.posY = fields[6].GetFloat();
data.posZ = fields[7].GetFloat();
@@ -1495,13 +1595,13 @@ void ObjectMgr::LoadCreatures()
if (!ok)
continue;
- // -1 no equipment, 0 use default
- if (data.equipmentId > 0)
+ // -1 random, 0 no equipment,
+ if (data.equipmentId != 0)
{
- if (!GetEquipmentInfo(data.equipmentId))
+ if (!GetEquipmentInfo(data.id, data.equipmentId))
{
sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId);
- data.equipmentId = -1;
+ data.equipmentId = 0;
}
}
@@ -1675,7 +1775,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
data.id = entry;
data.mapid = mapId;
data.displayid = 0;
- data.equipmentId = cInfo->equipmentId;
+ data.equipmentId = 0;
data.posX = x;
data.posY = y;
data.posZ = z;
@@ -1729,7 +1829,7 @@ void ObjectMgr::LoadGameobjects()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
return;
}
@@ -2754,8 +2854,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty.");
return;
}
@@ -2849,8 +2948,7 @@ void ObjectMgr::LoadPetLevelInfo()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
return;
}
@@ -2988,8 +3086,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
-
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
exit(1);
}
else
@@ -3146,8 +3243,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell");
}
else
{
@@ -3208,8 +3304,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
}
else
{
@@ -3254,7 +3349,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty.");
exit(1);
}
@@ -3336,8 +3431,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
exit(1);
}
@@ -3449,8 +3543,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty.");
exit(1);
}
@@ -3647,7 +3740,7 @@ void ObjectMgr::LoadQuests()
" FROM quest_template");
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
return;
}
@@ -4999,8 +5092,7 @@ void ObjectMgr::LoadInstanceEncounters()
QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 instance encounters, table is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance encounters, table is empty!");
return;
}
@@ -5020,7 +5112,7 @@ void ObjectMgr::LoadInstanceEncounters()
continue;
}
- if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeon(lastEncounterDungeon))
+ if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeonEntry(lastEncounterDungeon))
{
sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon);
continue;
@@ -6453,8 +6545,7 @@ void ObjectMgr::LoadExplorationBaseXP()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty.");
return;
}
@@ -6601,7 +6692,7 @@ void ObjectMgr::LoadReputationRewardRate()
QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, creature_rate, spell_rate FROM reputation_reward_rate");
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_reward_rate`, table is empty!");
return;
}
@@ -6689,8 +6780,7 @@ void ObjectMgr::LoadReputationOnKill()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
return;
}
@@ -6868,8 +6958,7 @@ void ObjectMgr::LoadPointsOfInterest()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
return;
}
@@ -6914,8 +7003,7 @@ void ObjectMgr::LoadQuestPOI()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
return;
}
@@ -6982,8 +7070,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
return;
}
@@ -7085,7 +7172,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const&
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
return;
}
@@ -7460,7 +7547,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (!result)
{
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
else
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table);
@@ -7536,8 +7623,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
return;
}
@@ -7665,8 +7751,7 @@ void ObjectMgr::LoadGameTele()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
return;
}
@@ -7805,8 +7890,7 @@ void ObjectMgr::LoadMailLevelRewards()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
return;
}
@@ -8072,8 +8156,7 @@ void ObjectMgr::LoadGossipMenu()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
return;
}
@@ -8118,8 +8201,7 @@ void ObjectMgr::LoadGossipMenuItems()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
return;
}
@@ -8326,8 +8408,7 @@ void ObjectMgr::LoadScriptNames()
if (!result)
{
-
- sLog->outError(LOG_FILTER_SQL, ">> Loaded empty set of Script Names!");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded empty set of Script Names!");
return;
}
@@ -8503,8 +8584,7 @@ void ObjectMgr::LoadFactionChangeAchievements()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
return;
}
@@ -8574,8 +8654,7 @@ void ObjectMgr::LoadFactionChangeSpells()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
return;
}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 9339684964c..12df01fc350 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -25,6 +25,7 @@
#include "Creature.h"
#include "DynamicObject.h"
#include "GameObject.h"
+#include "TemporarySummon.h"
#include "Corpse.h"
#include "QuestDef.h"
#include "ItemPrototype.h"
@@ -416,9 +417,29 @@ struct TrinityStringLocale
StringVector Content;
};
+/// Key for storing temp summon data in TempSummonDataContainer
+struct TempSummonGroupKey
+{
+ TempSummonGroupKey(uint32 summonerEntry, SummonerType summonerType, uint8 group)
+ : _summonerEntry(summonerEntry), _summonerType(summonerType), _summonGroup(group)
+ {
+ }
+
+ bool operator<(TempSummonGroupKey const& rhs) const
+ {
+ return memcmp(this, &rhs, sizeof(TempSummonGroupKey)) < 0;
+ }
+
+private:
+ uint32 _summonerEntry; ///< Summoner's entry
+ SummonerType _summonerType; ///< Summoner's type, see SummonerType for available types
+ uint8 _summonGroup; ///< Summon's group id
+};
+
typedef std::map<uint64, uint64> LinkedRespawnContainer;
typedef UNORDERED_MAP<uint32, CreatureData> CreatureDataContainer;
typedef UNORDERED_MAP<uint32, GameObjectData> GameObjectDataContainer;
+typedef std::map<TempSummonGroupKey, std::vector<TempSummonData> > TempSummonDataContainer;
typedef UNORDERED_MAP<uint32, CreatureLocale> CreatureLocaleContainer;
typedef UNORDERED_MAP<uint32, GameObjectLocale> GameObjectLocaleContainer;
typedef UNORDERED_MAP<uint32, ItemLocale> ItemLocaleContainer;
@@ -663,7 +684,7 @@ class ObjectMgr
CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID);
static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL);
static void ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data = NULL);
- EquipmentInfo const* GetEquipmentInfo(uint32 entry);
+ EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id);
CreatureAddon const* GetCreatureAddon(uint32 lowguid);
CreatureAddon const* GetCreatureTemplateAddon(uint32 entry);
ItemTemplate const* GetItemTemplate(uint32 entry);
@@ -876,6 +897,7 @@ class ObjectMgr
void LoadCreatureTemplates();
void LoadCreatureTemplateAddons();
void CheckCreatureTemplate(CreatureTemplate const* cInfo);
+ void LoadTempSummons();
void LoadCreatures();
void LoadLinkedRespawn();
bool SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid);
@@ -981,6 +1003,24 @@ class ObjectMgr
return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)][cell_id];
}
+ /**
+ * Gets temp summon data for all creatures of specified group.
+ *
+ * @param summonerId Summoner's entry.
+ * @param summonerType Summoner's type, see SummonerType for available types.
+ * @param group Id of required group.
+ *
+ * @return null if group was not found, otherwise reference to the creature group data
+ */
+ std::vector<TempSummonData> const* GetSummonGroup(uint32 summonerId, SummonerType summonerType, uint8 group) const
+ {
+ TempSummonDataContainer::const_iterator itr = _tempSummonDataStore.find(TempSummonGroupKey(summonerId, summonerType, group));
+ if (itr != _tempSummonDataStore.end())
+ return &itr->second;
+
+ return NULL;
+ }
+
CreatureData const* GetCreatureData(uint32 guid) const
{
CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid);
@@ -1294,6 +1334,8 @@ class ObjectMgr
GameObjectDataContainer _gameObjectDataStore;
GameObjectLocaleContainer _gameObjectLocaleStore;
GameObjectTemplateContainer _gameObjectTemplateStore;
+ /// Stores temp summon data grouped by summoner's entry, summoner's type and group id
+ TempSummonDataContainer _tempSummonDataStore;
ItemTemplateContainer _itemTemplateStore;
ItemLocaleContainer _itemLocaleStore;
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 711e07ef941..fe06c172e3f 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -634,7 +634,7 @@ void Group::ChangeLeader(uint64 guid)
if (!player)
return;
- sScriptMgr->OnGroupChangeLeader(this, m_leaderGuid, guid);
+ sScriptMgr->OnGroupChangeLeader(this, guid, m_leaderGuid);
if (!isBGGroup() && !isBFGroup())
{
@@ -1496,7 +1496,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
data << uint8(slot->roles);
if (isLFGGroup())
{
- data << uint8(sLFGMgr->GetState(m_guid) == 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));
}
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 376ee011638..a1ab1b22b08 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -983,12 +983,15 @@ void Guild::BankMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData*
void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const
{
MoveItemData::LogAction(pFrom);
- if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && !AccountMgr::IsPlayerAccount(m_pPlayer->GetSession()->GetSecurity())) // TODO: move to scripts
+ if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) &&
+ m_pPlayer->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE))
+ {
sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(),
"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)",
m_pPlayer->GetName().c_str(), m_pPlayer->GetSession()->GetAccountId(),
pFrom->GetItem()->GetTemplate()->Name1.c_str(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(),
m_pGuild->GetId());
+ }
}
Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const
@@ -1729,7 +1732,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&amount), 8, true);
_BroadcastEvent(GE_BANK_MONEY_CHANGED, 0, aux.c_str());
- if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (player->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(player->GetSession()->GetAccountId(),
"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
@@ -1755,16 +1758,20 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool
sScriptMgr->OnGuildMemberWitdrawMoney(this, player, amount, repair);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- // Update remaining money amount
- member->UpdateBankWithdrawValue(trans, GUILD_BANK_MAX_TABS, amount);
- // Remove money from bank
- _ModifyBankMoney(trans, amount, false);
// Add money to player (if required)
if (!repair)
{
- player->ModifyMoney(amount);
+ if (!player->ModifyMoney(amount))
+ return false;
+
player->SaveGoldToDB(trans);
}
+
+ // Update remaining money amount
+ member->UpdateBankWithdrawValue(trans, GUILD_BANK_MAX_TABS, amount);
+ // Remove money from bank
+ _ModifyBankMoney(trans, amount, false);
+
// Log guild bank event
_LogBankEvent(trans, repair ? GUILD_BANK_LOG_REPAIR_MONEY : GUILD_BANK_LOG_WITHDRAW_MONEY, uint8(0), player->GetGUIDLow(), amount);
CharacterDatabase.CommitTransaction(trans);
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
index 7e62280f17c..68c93259fcb 100644
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ b/src/server/game/Handlers/AddonHandler.cpp
@@ -30,7 +30,7 @@ AddonHandler::~AddonHandler()
{
}
-bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
+bool AddonHandler::BuildAddonPacket(WorldPacket* source, WorldPacket* target)
{
ByteBuffer AddOnPacked;
uLongf AddonRealSize;
@@ -38,10 +38,10 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint32 TempValue;
// broken addon packet, can't be received from real client
- if (Source->rpos() + 4 > Source->size())
+ if (source->rpos() + 4 > source->size())
return false;
- *Source >> TempValue; // get real size of the packed structure
+ *source >> TempValue; // get real size of the packed structure
// empty addon packet, nothing process, can't be received from real client
if (!TempValue)
@@ -49,13 +49,13 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
AddonRealSize = TempValue; // temp value because ZLIB only excepts uLongf
- CurrentPosition = Source->rpos(); // get the position of the pointer in the structure
+ CurrentPosition = source->rpos(); // get the position of the pointer in the structure
AddOnPacked.resize(AddonRealSize); // resize target for zlib action
- if (!uncompress(const_cast<uint8*>(AddOnPacked.contents()), &AddonRealSize, const_cast<uint8*>((*Source).contents() + CurrentPosition), (*Source).size() - CurrentPosition)!= Z_OK)
+ if (!uncompress(AddOnPacked.contents(), &AddonRealSize, source->contents() + CurrentPosition, source->size() - CurrentPosition)!= Z_OK)
{
- Target->Initialize(SMSG_ADDON_INFO);
+ target->Initialize(SMSG_ADDON_INFO);
uint32 addonsCount;
AddOnPacked >> addonsCount; // addons count?
@@ -81,14 +81,14 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
sLog->outDebug(LOG_FILTER_NETWORKIO, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2);
uint8 state = (enabled ? 2 : 1);
- *Target << uint8(state);
+ *target << uint8(state);
uint8 unk1 = (enabled ? 1 : 0);
- *Target << uint8(unk1);
+ *target << uint8(unk1);
if (unk1)
{
uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC
- *Target << uint8(unk);
+ *target << uint8(unk);
if (unk)
{
unsigned char tdata[256] =
@@ -110,18 +110,18 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
};
- Target->append(tdata, sizeof(tdata));
+ target->append(tdata, sizeof(tdata));
}
- *Target << uint32(0);
+ *target << uint32(0);
}
uint8 unk3 = (enabled ? 0 : 1);
- *Target << uint8(unk3);
+ *target << uint8(unk3);
if (unk3)
{
// String, 256 (null terminated?)
- *Target << uint8(0);
+ *target << uint8(0);
}
}
@@ -129,7 +129,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
AddOnPacked >> unk4;
uint32 count = 0;
- *Target << uint32(count);
+ *target << uint32(count);
if (AddOnPacked.rpos() != AddOnPacked.size())
sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under read!");
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 6fc88f441bb..22070d4c2c2 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -245,7 +245,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
if (itemsCount == 1 && item->GetCount() == count[i])
{
- if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
@@ -291,7 +291,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
return;
}
- if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 9dbc4bec199..86f943cf1bf 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -57,9 +57,9 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
- std::vector<CalendarInvite*> invites = sCalendarMgr->GetPlayerInvites(guid);
+ CalendarInviteStore invites = sCalendarMgr->GetPlayerInvites(guid);
data << uint32(invites.size());
- for (std::vector<CalendarInvite*>::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
+ for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
data << uint64((*itr)->GetEventId());
data << uint64((*itr)->GetInviteId());
@@ -347,9 +347,9 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
newEvent->SetEventTime(time_t(time));
sCalendarMgr->AddEvent(newEvent, CALENDAR_SENDTYPE_COPY);
- std::vector<CalendarInvite*> invites = sCalendarMgr->GetEventInvites(eventId);
+ CalendarInviteStore invites = sCalendarMgr->GetEventInvites(eventId);
- for (std::vector<CalendarInvite*>::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
+ for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
sCalendarMgr->AddInvite(newEvent, new CalendarInvite(**itr, sCalendarMgr->GetFreeInviteId(), newEvent->GetEventId()));
// should we change owner when somebody makes a copy of event owned by another person?
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index d8e50be11f0..eb5326e8094 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -215,7 +215,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
data << num;
- _allowedCharsToLogin.clear();
+ _legitCharacters.clear();
if (result)
{
do
@@ -224,7 +224,9 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
sLog->outInfo(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId());
if (Player::BuildEnumData(result, &data))
{
- _allowedCharsToLogin.insert(guidlow);
+ _legitCharacters.insert(guidlow);
+ if (!sWorld->HasCharacterNameData(guidlow)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet.
+ sWorld->AddCharacterNameData(guidlow, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8());
++num;
}
}
@@ -272,7 +274,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
- if (AccountMgr::IsPlayerAccount(GetSecurity()))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_TEAMMASK))
{
if (uint32 mask = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED))
{
@@ -281,13 +283,17 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
uint32 team = Player::TeamForRace(race_);
switch (team)
{
- case ALLIANCE: disabled = mask & (1 << 0); break;
- case HORDE: disabled = mask & (1 << 1); break;
+ case ALLIANCE:
+ disabled = mask & (1 << 0);
+ break;
+ case HORDE:
+ disabled = mask & (1 << 1);
+ break;
}
if (disabled)
{
- data << (uint8)CHAR_CREATE_DISABLED;
+ data << uint8(CHAR_CREATE_DISABLED);
SendPacket(&data);
return;
}
@@ -297,7 +303,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
if (!classEntry)
{
- data << (uint8)CHAR_CREATE_FAILED;
+ data << uint8(CHAR_CREATE_FAILED);
SendPacket(&data);
sLog->outError(LOG_FILTER_NETWORKIO, "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId());
return;
@@ -306,7 +312,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
if (!raceEntry)
{
- data << (uint8)CHAR_CREATE_FAILED;
+ data << uint8(CHAR_CREATE_FAILED);
SendPacket(&data);
sLog->outError(LOG_FILTER_NETWORKIO, "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId());
return;
@@ -315,7 +321,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
// prevent character creating Expansion race without Expansion account
if (raceEntry->expansion > Expansion())
{
- data << (uint8)CHAR_CREATE_EXPANSION;
+ data << uint8(CHAR_CREATE_EXPANSION);
sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
SendPacket(&data);
return;
@@ -324,13 +330,13 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
// prevent character creating Expansion class without Expansion account
if (classEntry->expansion > Expansion())
{
- data << (uint8)CHAR_CREATE_EXPANSION_CLASS;
+ data << uint8(CHAR_CREATE_EXPANSION_CLASS);
sLog->outError(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_);
SendPacket(&data);
return;
}
- if (AccountMgr::IsPlayerAccount(GetSecurity()))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RACEMASK))
{
uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK);
if ((1 << (race_ - 1)) & raceMaskDisabled)
@@ -339,7 +345,10 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
SendPacket(&data);
return;
}
+ }
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_CLASSMASK))
+ {
uint32 classMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK);
if ((1 << (class_ - 1)) & classMaskDisabled)
{
@@ -352,7 +361,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
// prevent character creating with invalid name
if (!normalizePlayerName(name))
{
- data << (uint8)CHAR_NAME_NO_NAME;
+ data << uint8(CHAR_NAME_NO_NAME);
SendPacket(&data);
sLog->outError(LOG_FILTER_NETWORKIO, "Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
return;
@@ -367,29 +376,32 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
return;
}
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(name))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(name))
{
- data << (uint8)CHAR_NAME_RESERVED;
+ data << uint8(CHAR_NAME_RESERVED);
SendPacket(&data);
return;
}
- // speedup check for heroic class disabled case
- uint32 heroic_free_slots = sWorld->getIntConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
- if (heroic_free_slots == 0 && AccountMgr::IsPlayerAccount(GetSecurity()) && class_ == CLASS_DEATH_KNIGHT)
+ if (class_ == CLASS_DEATH_KNIGHT && !HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_HEROIC_CHARACTER))
{
- data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
- SendPacket(&data);
- return;
- }
+ // speedup check for heroic class disabled case
+ uint32 heroic_free_slots = sWorld->getIntConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
+ if (heroic_free_slots == 0)
+ {
+ data << uint8(CHAR_CREATE_UNIQUE_CLASS_LIMIT);
+ SendPacket(&data);
+ return;
+ }
- // speedup check for heroic class disabled case
- uint32 req_level_for_heroic = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
- {
- data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
- SendPacket(&data);
- return;
+ // speedup check for heroic class disabled case
+ uint32 req_level_for_heroic = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
+ if (req_level_for_heroic > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
+ {
+ data << uint8(CHAR_CREATE_LEVEL_REQUIREMENT);
+ SendPacket(&data);
+ return;
+ }
}
delete _charCreateCallback.GetParam(); // Delete existing if any, to make the callback chain reset to stage 0
@@ -480,7 +492,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
}
}
- bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
+ bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || HasPermission(RBAC_PERM_TWO_SIDE_CHARACTER_CREATION);
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
_charCreateCallback.FreeResult();
@@ -504,8 +516,9 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
bool haveSameRace = false;
uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
bool hasHeroicReqLevel = (heroicReqLevel == 0);
- bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
+ bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || HasPermission(RBAC_PERM_TWO_SIDE_CHARACTER_CREATION);
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
+ bool checkHeroicReqs = createInfo->Class == CLASS_DEATH_KNIGHT && !HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_HEROIC_CHARACTER);
if (result)
{
@@ -515,7 +528,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
Field* field = result->Fetch();
uint8 accRace = field[1].GetUInt8();
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT)
+ if (checkHeroicReqs)
{
uint8 accClass = field[2].GetUInt8();
if (accClass == CLASS_DEATH_KNIGHT)
@@ -574,7 +587,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
if (!haveSameRace)
haveSameRace = createInfo->Race == accRace;
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT)
+ if (checkHeroicReqs)
{
uint8 acc_class = field[2].GetUInt8();
if (acc_class == CLASS_DEATH_KNIGHT)
@@ -603,7 +616,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
}
}
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT && !hasHeroicReqLevel)
+ if (checkHeroicReqs && !hasHeroicReqLevel)
{
WorldPacket data(SMSG_CHAR_CREATE, 1);
data << uint8(CHAR_CREATE_LEVEL_REQUIREMENT);
@@ -725,7 +738,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
std::string IP_str = GetRemoteAddress();
sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level);
sScriptMgr->OnPlayerDelete(guid);
- sWorld->DeleteCharaceterNameData(GUID_LOPART(guid));
+ sWorld->DeleteCharacterNameData(GUID_LOPART(guid));
if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
@@ -757,7 +770,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
recvData >> playerGuid;
- if (!CharCanLogin(GUID_LOPART(playerGuid)))
+ if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid)))
{
sLog->outError(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
KickPlayer();
@@ -1120,7 +1133,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
}
// check name limitations
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newName))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newName))
{
WorldPacket data(SMSG_CHAR_RENAME, 1);
data << uint8(CHAR_NAME_RESERVED);
@@ -1384,6 +1397,15 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
std::string newName;
recvData >> guid;
+ if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ {
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ recvData.rfinish();
+ KickPlayer();
+ return;
+ }
+
recvData >> newName;
uint8 gender, skin, face, hairStyle, hairColor, facialHair;
@@ -1392,7 +1414,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN);
stmt->setUInt32(0, GUID_LOPART(guid));
-
+ // TODO: Make async with callback
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -1433,7 +1455,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
}
// check name limitations
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newName))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newName))
{
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
data << uint8(CHAR_NAME_RESERVED);
@@ -1617,6 +1639,16 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
std::string newname;
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
recvData >> guid;
+
+ if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ {
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ recvData.rfinish();
+ KickPlayer();
+ return;
+ }
+
recvData >> newname;
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
@@ -1624,6 +1656,14 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
// get the players old (at this moment current) race
CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGuid);
+ if (!nameData)
+ {
+ WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
+ data << uint8(CHAR_CREATE_ERROR);
+ SendPacket(&data);
+ return;
+ }
+
uint8 oldRace = nameData->m_race;
uint8 playerClass = nameData->m_class;
uint8 level = nameData->m_level;
@@ -1661,7 +1701,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
return;
}
- if (AccountMgr::IsPlayerAccount(GetSecurity()))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RACEMASK))
{
uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK);
if ((1 << (race - 1)) & raceMaskDisabled)
@@ -1692,7 +1732,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
}
// check name limitations
- if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newname))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newname))
{
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
data << uint8(CHAR_NAME_RESERVED);
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index d04d365504d..efb3a3b6d7c 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -273,20 +273,22 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
Player* receiver = sObjectAccessor->FindPlayerByName(to);
- bool senderIsPlayer = AccountMgr::IsPlayerAccount(GetSecurity());
- bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER);
- if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
+ if (!receiver || (!HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) &&
+ receiver->GetSession()->HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) &&
+ !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
{
SendPlayerNotFoundNotice(to);
return;
}
- if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer)
- if (GetPlayer()->GetTeam() != receiver->GetTeam())
- {
- SendWrongFactionNotice();
- return;
- }
+ if (GetPlayer()->GetTeam() != receiver->GetTeam() &&
+ (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) ||
+ !HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHAT) ||
+ !receiver->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_CHAT)))
+ {
+ SendWrongFactionNotice();
+ return;
+ }
if (GetPlayer()->HasAura(1852) && !receiver->isGameMaster())
{
@@ -295,7 +297,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
// If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to
- if (!senderIsPlayer && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))
+ if (HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))
sender->AddWhisperWhiteList(receiver->GetGUID());
GetPlayer()->Whisper(msg, lang, receiver->GetGUID());
@@ -420,7 +422,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
} break;
case CHAT_MSG_CHANNEL:
{
- if (AccountMgr::IsPlayerAccount(GetSecurity()))
+ if (!HasPermission(RBAC_PERM_SKIP_CHECK_CHAT_CHANNEL_REQ))
{
if (_player->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
{
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 0654ae326f9..619e9b68b51 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -23,20 +23,20 @@
#include "WorldPacket.h"
#include "WorldSession.h"
-void BuildPlayerLockDungeonBlock(WorldPacket& data, LfgLockMap const& lock)
+void BuildPlayerLockDungeonBlock(WorldPacket& data, lfg::LfgLockMap const& lock)
{
data << uint32(lock.size()); // Size of lock dungeons
- for (LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it)
+ for (lfg::LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it)
{
data << uint32(it->first); // Dungeon entry (id + type)
data << uint32(it->second); // Lock status
}
}
-void BuildPartyLockDungeonBlock(WorldPacket& data, const LfgLockPartyMap& lockMap)
+void BuildPartyLockDungeonBlock(WorldPacket& data, lfg::LfgLockPartyMap const& lockMap)
{
data << uint8(lockMap.size());
- for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
+ for (lfg::LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
{
data << uint64(it->first); // Player guid
BuildPlayerLockDungeonBlock(data, it->second);
@@ -45,7 +45,7 @@ void BuildPartyLockDungeonBlock(WorldPacket& data, const LfgLockPartyMap& lockMa
void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
{
- if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER) ||
+ if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER) ||
(GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() &&
(GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup())))
{
@@ -66,7 +66,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
return;
}
- LfgDungeonSet newDungeons;
+ lfg::LfgDungeonSet newDungeons;
for (int8 i = 0; i < numDungeons; ++i)
{
uint32 dungeon;
@@ -167,21 +167,12 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
GetPlayerInfo().c_str());
// Get Random dungeons that can be done at a certain level and expansion
- LfgDungeonSet randomDungeons;
uint8 level = GetPlayer()->getLevel();
- uint8 expansion = GetPlayer()->GetSession()->Expansion();
-
- LFGDungeonContainer& LfgDungeons = sLFGMgr->GetLFGDungeonMap();
- for (LFGDungeonContainer::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr)
- {
- LFGDungeonData const& dungeon = itr->second;
- if ((dungeon.type == LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id)))
- && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel)
- randomDungeons.insert(dungeon.Entry());
- }
+ lfg::LfgDungeonSet const& randomDungeons =
+ sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion());
// Get player locked Dungeons
- LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid);
+ lfg::LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid);
uint32 rsize = uint32(randomDungeons.size());
uint32 lsize = uint32(lock.size());
@@ -189,10 +180,10 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));
data << uint8(randomDungeons.size()); // Random Dungeon count
- for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
+ for (lfg::LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
{
data << uint32(*it); // Dungeon Entry (id + type)
- LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
+ lfg::LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
Quest const* quest = NULL;
bool done = false;
if (reward)
@@ -250,7 +241,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
return;
// Get the locked dungeons of the other party members
- LfgLockPartyMap lockMap;
+ lfg::LfgLockPartyMap lockMap;
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* plrg = itr->getSource();
@@ -265,7 +256,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
}
uint32 size = 0;
- for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
+ for (lfg::LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
size += 8 + 4 + uint32(it->second.size()) * (4 + 4);
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PARTY_INFO %s", GetPlayerInfo().c_str());
@@ -297,7 +288,7 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str());
uint64 guid = GetPlayer()->GetGUID();
- LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
+ lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
if (GetPlayer()->GetGroup())
{
@@ -313,19 +304,19 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
}
}
-void WorldSession::SendLfgUpdatePlayer(LfgUpdateData const& updateData)
+void WorldSession::SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData)
{
bool queued = false;
uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType)
{
- case LFG_UPDATETYPE_JOIN_QUEUE:
- case LFG_UPDATETYPE_ADDED_TO_QUEUE:
+ case lfg::LFG_UPDATETYPE_JOIN_QUEUE:
+ case lfg::LFG_UPDATETYPE_ADDED_TO_QUEUE:
queued = true;
break;
- case LFG_UPDATETYPE_UPDATE_STATUS:
- queued = updateData.state == LFG_STATE_QUEUED;
+ case lfg::LFG_UPDATETYPE_UPDATE_STATUS:
+ queued = updateData.state == lfg::LFG_STATE_QUEUED;
break;
default:
break;
@@ -343,14 +334,14 @@ void WorldSession::SendLfgUpdatePlayer(LfgUpdateData const& updateData)
data << uint8(0); // unk - Always 0
data << uint8(size);
- for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
+ for (lfg::LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
data << uint32(*it);
data << updateData.comment;
}
SendPacket(&data);
}
-void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
+void WorldSession::SendLfgUpdateParty(const lfg::LfgUpdateData& updateData)
{
bool join = false;
bool queued = false;
@@ -358,15 +349,15 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
switch (updateData.updateType)
{
- case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success
+ case lfg::LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success
queued = true;
// no break on purpose
- case LFG_UPDATETYPE_PROPOSAL_BEGIN:
+ case lfg::LFG_UPDATETYPE_PROPOSAL_BEGIN:
join = true;
break;
- case LFG_UPDATETYPE_UPDATE_STATUS:
- join = updateData.state != LFG_STATE_ROLECHECK && updateData.state != LFG_STATE_NONE;
- queued = updateData.state == LFG_STATE_QUEUED;
+ case lfg::LFG_UPDATETYPE_UPDATE_STATUS:
+ join = updateData.state != lfg::LFG_STATE_ROLECHECK && updateData.state != lfg::LFG_STATE_NONE;
+ queued = updateData.state == lfg::LFG_STATE_QUEUED;
break;
default:
break;
@@ -387,7 +378,7 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
data << uint8(0); // unk - Always 0
data << uint8(size);
- for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
+ for (lfg::LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
data << uint32(*it);
data << updateData.comment;
}
@@ -406,9 +397,9 @@ void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
SendPacket(&data);
}
-void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
+void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
{
- LfgDungeonSet dungeons;
+ lfg::LfgDungeonSet dungeons;
if (roleCheck.rDungeonId)
dungeons.insert(roleCheck.rDungeonId);
else
@@ -418,16 +409,11 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1));
data << uint32(roleCheck.state); // Check result
- data << uint8(roleCheck.state == LFG_ROLECHECK_INITIALITING);
+ data << uint8(roleCheck.state == lfg::LFG_ROLECHECK_INITIALITING);
data << uint8(dungeons.size()); // Number of dungeons
if (!dungeons.empty())
- {
- for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
- {
- LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(*it);
- data << uint32(dungeon ? dungeon->Entry() : 0); // Dungeon
- }
- }
+ for (lfg::LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
+ data << uint32(sLFGMgr->GetLFGDungeonEntry(*it)); // Dungeon
data << uint8(roleCheck.roles.size()); // Players in group
if (!roleCheck.roles.empty())
@@ -441,7 +427,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
Player* player = ObjectAccessor::FindPlayer(guid);
data << uint8(player ? player->getLevel() : 0); // Level
- for (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;
@@ -458,10 +444,10 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
SendPacket(&data);
}
-void WorldSession::SendLfgJoinResult(LfgJoinResultData const& joinData)
+void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData)
{
uint32 size = 0;
- for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it)
+ for (lfg::LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it)
size += 8 + 4 + uint32(it->second.size()) * (4 + 4);
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_JOIN_RESULT %s checkResult: %u checkValue: %u",
@@ -475,7 +461,7 @@ void WorldSession::SendLfgJoinResult(LfgJoinResultData const& joinData)
SendPacket(&data);
}
-void WorldSession::SendLfgQueueStatus(LfgQueueStatusData const& queueData)
+void WorldSession::SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData)
{
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_QUEUE_STATUS %s dungeon: %u, waitTime: %d, "
"avgWaitTime: %d, waitTimeTanks: %d, waitTimeHealer: %d, waitTimeDps: %d, "
@@ -498,7 +484,7 @@ void WorldSession::SendLfgQueueStatus(LfgQueueStatusData const& queueData)
SendPacket(&data);
}
-void WorldSession::SendLfgPlayerReward(LfgPlayerRewardData const& rewardData)
+void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardData)
{
if (!rewardData.rdungeonEntry || !rewardData.sdungeonEntry || !rewardData.quest)
return;
@@ -532,42 +518,42 @@ void WorldSession::SendLfgPlayerReward(LfgPlayerRewardData const& rewardData)
SendPacket(&data);
}
-void WorldSession::SendLfgBootProposalUpdate(LfgPlayerBoot const& boot)
+void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
{
uint64 guid = GetPlayer()->GetGUID();
- LfgAnswer playerVote = boot.votes.find(guid)->second;
+ lfg::LfgAnswer playerVote = boot.votes.find(guid)->second;
uint8 votesNum = 0;
uint8 agreeNum = 0;
uint32 secsleft = uint8((boot.cancelTime - time(NULL)) / 1000);
- for (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_ANSWER_PENDING)
+ if (it->second != lfg::LFG_ANSWER_PENDING)
{
++votesNum;
- if (it->second == LFG_ANSWER_AGREE)
+ if (it->second == lfg::LFG_ANSWER_AGREE)
++agreeNum;
}
}
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_BOOT_PROPOSAL_UPDATE %s inProgress: %u - "
"didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - "
"needed: %u - reason %s",
- GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != LFG_ANSWER_PENDING),
- uint8(playerVote == LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum,
- secsleft, LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
+ GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING),
+ uint8(playerVote == lfg::LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum,
+ secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());
data << uint8(boot.inProgress); // Vote in progress
- data << uint8(playerVote != LFG_ANSWER_PENDING); // Did Vote
- data << uint8(playerVote == LFG_ANSWER_AGREE); // Agree
+ data << uint8(playerVote != lfg::LFG_ANSWER_PENDING); // Did Vote
+ data << uint8(playerVote == lfg::LFG_ANSWER_AGREE); // Agree
data << uint64(boot.victim); // Victim GUID
data << uint32(votesNum); // Total Votes
data << uint32(agreeNum); // Agree Count
data << uint32(secsleft); // Time Left
- data << uint32(LFG_GROUP_KICK_VOTES_NEEDED); // Needed Votes
+ data << uint32(lfg::LFG_GROUP_KICK_VOTES_NEEDED); // Needed Votes
data << boot.reason.c_str(); // Kick reason
SendPacket(&data);
}
-void WorldSession::SendLfgUpdateProposal(LfgProposal const& proposal)
+void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal)
{
uint64 guid = GetPlayer()->GetGUID();
uint64 gguid = proposal.players.find(guid)->second.group;
@@ -580,13 +566,12 @@ void WorldSession::SendLfgUpdateProposal(LfgProposal const& proposal)
// show random dungeon if player selected random dungeon and it's not lfg group
if (!silent)
{
- LfgDungeonSet const& playerDungeons = sLFGMgr->GetSelectedDungeons(guid);
+ lfg::LfgDungeonSet const& playerDungeons = sLFGMgr->GetSelectedDungeons(guid);
if (playerDungeons.find(proposal.dungeonId) == playerDungeons.end())
dungeonEntry = (*playerDungeons.begin());
}
- if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonEntry))
- dungeonEntry = dungeon->Entry();
+ dungeonEntry = sLFGMgr->GetLFGDungeonEntry(dungeonEntry);
WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + proposal.players.size() * (4 + 1 + 1 + 1 + 1 +1));
data << uint32(dungeonEntry); // Dungeon
@@ -596,9 +581,9 @@ void WorldSession::SendLfgUpdateProposal(LfgProposal const& proposal)
data << uint8(silent); // Show proposal window
data << uint8(proposal.players.size()); // Group size
- for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (lfg::LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- LfgProposalPlayer const& player = it->second;
+ lfg::LfgProposalPlayer const& player = it->second;
data << uint32(player.role); // Role
data << uint8(it->first == guid); // Self player
if (!player.group) // Player not it a group
@@ -611,8 +596,8 @@ void WorldSession::SendLfgUpdateProposal(LfgProposal const& proposal)
data << uint8(player.group == proposal.group); // In dungeon (silent)
data << uint8(player.group == gguid); // Same Group than player
}
- data << uint8(player.accept != LFG_ANSWER_PENDING);// Answered
- data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted
+ data << uint8(player.accept != lfg::LFG_ANSWER_PENDING);// Answered
+ data << uint8(player.accept == lfg::LFG_ANSWER_AGREE); // Accepted
}
SendPacket(&data);
}
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 74fd18b31ed..b9a615052bb 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -99,7 +99,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
player->GetSession()->DoLootRelease(lguid);
}
-void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
+void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_MONEY");
@@ -188,7 +188,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1);
data << uint32(goldPerPlayer);
- data << uint8(playersNear.size() > 1 ? 0 : 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..."
+ data << uint8(playersNear.size() <= 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..."
(*i)->GetSession()->SendPacket(&data);
}
}
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 5aeb59e7383..3cdd3d854a1 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -32,23 +32,16 @@
void WorldSession::HandleSendMail(WorldPacket& recvData)
{
uint64 mailbox, unk3;
- std::string receiver, subject, body;
+ std::string receiverName, subject, body;
uint32 unk1, unk2, money, COD;
uint8 unk4;
- recvData >> mailbox;
- recvData >> receiver;
-
- recvData >> subject;
-
- recvData >> body;
-
- recvData >> unk1; // stationery?
- recvData >> unk2; // 0x00000000
-
uint8 items_count;
- recvData >> items_count; // attached items count
+ recvData >> mailbox >> receiverName >> subject >> body
+ >> unk1 // stationery?
+ >> unk2 // 0x00000000
+ >> items_count; // attached items count
- if (items_count > MAX_MAIL_ITEMS) // client limit
+ if (items_count > MAX_MAIL_ITEMS) // client limit
{
GetPlayer()->SendMailResult(0, MAIL_SEND, MAIL_ERR_TOO_MANY_ATTACHMENTS);
recvData.rfinish(); // set to end to avoid warnings spam
@@ -72,7 +65,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
- if (receiver.empty())
+ if (receiverName.empty())
return;
Player* player = _player;
@@ -83,21 +76,26 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
return;
}
- uint64 rc = 0;
- if (normalizePlayerName(receiver))
- rc = sObjectMgr->GetPlayerGUIDByName(receiver);
+ uint64 receiverGuid = 0;
+ if (normalizePlayerName(receiverName))
+ receiverGuid = sObjectMgr->GetPlayerGUIDByName(receiverName);
- if (!rc)
+ if (!receiverGuid)
{
- sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
- player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: not existed!) with subject %s "
+ "and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
+ player->GetGUIDLow(), receiverName.c_str(), subject.c_str(), body.c_str(),
+ items_count, money, COD, unk1, unk2);
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
return;
}
- sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s "
+ "includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
+ player->GetGUIDLow(), receiverName.c_str(), GUID_LOPART(receiverGuid), subject.c_str(),
+ body.c_str(), items_count, money, COD, unk1, unk2);
- if (player->GetGUID() == rc)
+ if (player->GetGUID() == receiverGuid)
{
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
return;
@@ -113,58 +111,62 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
return;
}
- Player* receive = ObjectAccessor::FindPlayer(rc);
+ Player* receiver = ObjectAccessor::FindPlayer(receiverGuid);
- uint32 rc_team = 0;
- uint8 mails_count = 0; //do not allow to send to one player more than 100 mails
- uint8 receiveLevel = 0;
+ uint32 receiverTeam = 0;
+ uint8 mailsCount = 0; //do not allow to send to one player more than 100 mails
+ uint8 receiverLevel = 0;
+ uint32 receiverAccountId = 0;
+ bool canReceiveMailFromOtherFaction = false;
- if (receive)
+ if (receiver)
{
- rc_team = receive->GetTeam();
- mails_count = receive->GetMailSize();
- receiveLevel = receive->getLevel();
+ receiverTeam = receiver->GetTeam();
+ mailsCount = receiver->GetMailSize();
+ receiverLevel = receiver->getLevel();
+ receiverAccountId = receiver->GetSession()->GetAccountId();
+ canReceiveMailFromOtherFaction = receiver->GetSession()->HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_MAIL);
}
else
{
- rc_team = sObjectMgr->GetPlayerTeamByGUID(rc);
+ receiverTeam = sObjectMgr->GetPlayerTeamByGUID(receiverGuid);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT);
-
- stmt->setUInt32(0, GUID_LOPART(rc));
+ stmt->setUInt32(0, GUID_LOPART(receiverGuid));
PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
if (result)
{
Field* fields = result->Fetch();
- mails_count = fields[0].GetUInt64();
+ mailsCount = fields[0].GetUInt64();
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL);
-
- stmt->setUInt32(0, GUID_LOPART(rc));
+ stmt->setUInt32(0, GUID_LOPART(receiverGuid));
result = CharacterDatabase.Query(stmt);
-
if (result)
{
Field* fields = result->Fetch();
- receiveLevel = fields[0].GetUInt8();
+ receiverLevel = fields[0].GetUInt8();
}
+
+ receiverAccountId = sObjectMgr->GetPlayerAccountIdByGUID(receiverGuid);
+ canReceiveMailFromOtherFaction = AccountMgr::HasPermission(receiverAccountId, RBAC_PERM_TWO_SIDE_INTERACTION_MAIL, realmID);
}
- //do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
- if (mails_count > 100)
+
+ // do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
+ if (mailsCount > 100)
{
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
return;
}
+
// test the receiver's Faction... or all items are account bound
bool accountBound = items_count ? true : false;
for (uint8 i = 0; i < items_count; ++i)
{
- Item* item = player->GetItemByGuid(itemGUIDs[i]);
- if (item)
+ if (Item* item = player->GetItemByGuid(itemGUIDs[i]))
{
ItemTemplate const* itemProto = item->GetTemplate();
if (!itemProto || !(itemProto->Flags & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT))
@@ -175,22 +177,21 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
}
}
- if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity()))
+ if (!accountBound && player->GetTeam() != receiverTeam && // Sender and reciver are from different faction
+ (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) || // Config not enabled
+ !HasPermission(RBAC_PERM_TWO_SIDE_INTERACTION_MAIL) || // Sender cant mail interact with the other faction
+ !canReceiveMailFromOtherFaction)) // Receiver cant mail interact with the other faction
{
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
return;
}
- if (receiveLevel < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
+ if (receiverLevel < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
{
SendNotification(GetTrinityString(LANG_MAIL_RECEIVER_REQ), sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
return;
}
- uint32 rc_account = receive
- ? receive->GetSession()->GetAccountId()
- : sObjectMgr->GetPlayerAccountIdByGUID(rc);
-
Item* items[MAX_MAIL_ITEMS];
for (uint8 i = 0; i < items_count; ++i)
@@ -216,7 +217,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
return;
}
- if (item->IsBoundAccountWide() && item->IsSoulBound() && player->GetSession()->GetAccountId() != rc_account)
+ if (item->IsBoundAccountWide() && item->IsSoulBound() && player->GetSession()->GetAccountId() != receiverAccountId)
{
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS);
return;
@@ -256,35 +257,38 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (items_count > 0 || money > 0)
{
+ bool log = sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && HasPermission(RBAC_PERM_LOG_GM_TRADE);
if (items_count > 0)
{
for (uint8 i = 0; i < items_count; ++i)
{
Item* item = items[i];
- if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (log)
{
- sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
- GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
+ sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) "
+ "to player: %s (Account: %u)", GetPlayerName().c_str(), GetAccountId(),
+ item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(),
+ receiverName.c_str(), receiverAccountId);
}
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
player->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true);
item->DeleteFromInventoryDB(trans); // deletes item from character's inventory
- item->SetOwnerGUID(rc);
+ item->SetOwnerGUID(receiverGuid);
item->SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
draft.AddItem(item);
}
// if item send to character at another account, then apply item delivery delay
- needItemDelay = player->GetSession()->GetAccountId() != rc_account;
+ needItemDelay = player->GetSession()->GetAccountId() != receiverAccountId;
}
- if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (log && money > 0)
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
- GetPlayerName().c_str(), GetAccountId(), money, receiver.c_str(), rc_account);
+ GetPlayerName().c_str(), GetAccountId(), money, receiverName.c_str(), receiverAccountId);
}
}
@@ -295,7 +299,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
draft
.AddMoney(money)
.AddCOD(COD)
- .SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
+ .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
@@ -458,17 +462,17 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail
{
uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER);
- Player* receive = ObjectAccessor::FindPlayer(sender_guid);
+ Player* receiver = ObjectAccessor::FindPlayer(sender_guid);
uint32 sender_accId = 0;
- if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
std::string sender_name;
- if (receive)
+ if (receiver)
{
- sender_accId = receive->GetSession()->GetAccountId();
- sender_name = receive->GetName();
+ sender_accId = receiver->GetSession()->GetAccountId();
+ sender_name = receiver->GetName();
}
else
{
@@ -478,18 +482,18 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
if (!sObjectMgr->GetPlayerNameByGUID(sender_guid, sender_name))
sender_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
}
- sLog->outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
+ sLog->outCommand(GetAccountId(), "GM %s (Account: %u) receiver mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
}
- else if (!receive)
+ else if (!receiver)
sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid);
// check player existence
- if (receive || sender_accId)
+ if (receiver || sender_accId)
{
MailDraft(m->subject, "")
.AddMoney(m->COD)
- .SendMailTo(trans, MailReceiver(receive, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
+ .SendMailTo(trans, MailReceiver(receiver, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
}
player->ModifyMoney(-int32(m->COD));
@@ -532,13 +536,18 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
return;
}
- player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
+ if (!player->ModifyMoney(m->money, false))
+ {
+ player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_TOO_MUCH_GOLD);
+ return;
+ }
- player->ModifyMoney(m->money);
m->money = 0;
m->state = MAIL_STATE_CHANGED;
player->m_mailsUpdated = true;
+ player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
+
// save money and mail to prevent cheating
SQLTransaction trans = CharacterDatabase.BeginTransaction();
player->SaveGoldToDB(trans);
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 1aadd7f319d..3864acb8f88 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -241,7 +241,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
level_max = STRONG_MAX_LEVEL;
uint32 team = _player->GetTeam();
- 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;
@@ -254,42 +254,40 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
for (HashMapHolder<Player>::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->GetTeam() != team && !allowTwoSideWhoList)
- continue;
+ Player* target = itr->second;
+ // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST
+ if (target->GetTeam() != team && !allowTwoSideWhoList && !HasPermission(RBAC_PERM_TWO_SIDE_WHO_LIST))
+ 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 (!HasPermission(RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS) && target->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList))
+ continue;
- //do not process players which are not in world
- if (!(itr->second->IsInWorld()))
+ // do not process players which are not in world
+ if (!target->IsInWorld())
continue;
// check if target is globally visible for player
- if (!(itr->second->IsVisibleGloballyFor(_player)))
+ if (!target->IsVisibleGloballyFor(_player))
continue;
// check if target's level is in level range
- uint8 lvl = itr->second->getLevel();
+ uint8 lvl = target->getLevel();
if (lvl < level_min || lvl > level_max)
continue;
// check if class matches classmask
- uint32 class_ = itr->second->getClass();
+ uint8 class_ = target->getClass();
if (!(classmask & (1 << class_)))
continue;
// check if race matches racemask
- uint32 race = itr->second->getRace();
+ uint32 race = target->getRace();
if (!(racemask & (1 << race)))
continue;
- uint32 pzoneid = itr->second->GetZoneId();
- uint8 gender = itr->second->getGender();
+ uint32 pzoneid = target->GetZoneId();
+ uint8 gender = target->getGender();
bool z_show = true;
for (uint32 i = 0; i < zones_count; ++i)
@@ -305,7 +303,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
if (!z_show)
continue;
- std::string pname = itr->second->GetName();
+ std::string pname = target->GetName();
std::wstring wpname;
if (!Utf8toWStr(pname, wpname))
continue;
@@ -314,7 +312,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
continue;
- std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId());
+ std::string gname = sGuildMgr->GetGuildNameById(target->GetGuildId());
std::wstring wgname;
if (!Utf8toWStr(gname, wgname))
continue;
@@ -324,7 +322,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
continue;
std::string aname;
- if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
+ if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(pzoneid))
aname = areaEntry->area_name[GetSessionDbcLocale()];
bool s_show = true;
@@ -375,33 +373,34 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
if (uint64 lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);
- uint8 reason = 0;
+ bool instantLogout = (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->isInCombat()) ||
+ GetPlayer()->isInFlight() || HasPermission(RBAC_PERM_INSTANT_LOGOUT);
+
+ /// TODO: Possibly add RBAC permission to log out in combat
+ bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
- if (GetPlayer()->isInCombat())
+ uint32 reason = 0;
+ if (GetPlayer()->isInCombat() && !canLogoutInCombat)
reason = 1;
else if (GetPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR))
reason = 3; // is jumping or falling
else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
reason = 2; // FIXME - Need the correct value
+ WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
+ data << uint32(reason);
+ data << uint8(instantLogout);
+ SendPacket(&data);
+
if (reason)
{
- WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
- data << uint8(reason);
- data << uint32(0);
- SendPacket(&data);
LogoutRequest(0);
return;
}
//instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in worldserver.conf
- if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() ||
- GetSecurity() >= AccountTypes(sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT)))
+ if (instantLogout)
{
- WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
- data << uint8(0);
- data << uint32(16777216);
- SendPacket(&data);
LogoutPlayer(true);
return;
}
@@ -418,10 +417,6 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
- WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
- data << uint8(0);
- data << uint32(0);
- SendPacket(&data);
LogoutRequest(time(NULL));
}
@@ -578,13 +573,14 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
team = Player::TeamForRace(fields[1].GetUInt8());
friendAccountId = fields[2].GetUInt32();
- if (!AccountMgr::IsPlayerAccount(GetSecurity()) || sWorld->getBoolConfig(CONFIG_ALLOW_GM_FRIEND) || AccountMgr::IsPlayerAccount(AccountMgr::GetSecurity(friendAccountId, realmID)))
+ if (HasPermission(RBAC_PERM_ALLOW_GM_FRIEND) || sWorld->getBoolConfig(CONFIG_ALLOW_GM_FRIEND) ||
+ AccountMgr::IsPlayerAccount(AccountMgr::GetSecurity(friendAccountId, realmID)))
{
if (friendGuid)
{
if (friendGuid == GetPlayer()->GetGUID())
friendResult = FRIEND_SELF;
- else if (GetPlayer()->GetTeam() != team && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity()))
+ else if (GetPlayer()->GetTeam() != team && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && !HasPermission(RBAC_PERM_TWO_SIDE_ADD_FRIEND))
friendResult = FRIEND_ENEMY;
else if (GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
friendResult = FRIEND_ALREADY;
@@ -976,7 +972,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recvData)
dest.resize(decompressedSize);
uLongf realSize = decompressedSize;
- if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recvData.contents() + recvData.rpos()), recvData.size() - recvData.rpos()) != Z_OK)
+ if (uncompress(dest.contents(), &realSize, recvData.contents() + recvData.rpos(), recvData.size() - recvData.rpos()) != Z_OK)
{
recvData.rfinish(); // unnneded warning spam in this case
sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Failed to decompress account data");
@@ -1017,7 +1013,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recvData)
ByteBuffer dest;
dest.resize(destSize);
- if (size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
+ if (size && compress(dest.contents(), &destSize, (uint8 const*)adata->Data.c_str(), size) != Z_OK)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "RAD: Failed to compress account data");
return;
@@ -1251,7 +1247,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recvData)
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f",
GetPlayer()->GetName().c_str(), time, mapid, PositionX, PositionY, PositionZ, Orientation);
- if (AccountMgr::IsAdminAccount(GetSecurity()))
+ if (HasPermission(RBAC_PERM_OPCODE_WORLD_TELEPORT))
GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation);
else
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
@@ -1263,7 +1259,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recvData)
std::string charname;
recvData >> charname;
- if (!AccountMgr::IsAdminAccount(GetSecurity()))
+ if (HasPermission(RBAC_PERM_OPCODE_WHOIS))
{
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
return;
@@ -1587,8 +1583,7 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recvData*/)
return;
}
- _player->Dismount();
- _player->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ _player->RemoveAurasByType(SPELL_AURA_MOUNTED); // Calls Dismount()
}
void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index 4463613a97b..2da2735a3f9 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -69,7 +69,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
dest.resize(decompressedSize);
uLongf realSize = decompressedSize;
- if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recvData.contents() + pos), recvData.size() - pos) == Z_OK)
+ if (uncompress(dest.contents(), &realSize, recvData.contents() + pos, recvData.size() - pos) == Z_OK)
{
dest >> chatLog;
ticket->SetChatLog(times, chatLog);
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index 2f9db8687c3..7fbb68b70f8 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -152,7 +152,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
{
// logging
sLog->outDebug(LOG_FILTER_NETWORKIO, "partner storing: %u", myItems[i]->GetGUIDLow());
- if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
@@ -170,7 +170,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
{
// logging
sLog->outDebug(LOG_FILTER_NETWORKIO, "player storing: %u", hisItems[i]->GetGUIDLow());
- if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
@@ -292,6 +292,20 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
return;
}
+ if (_player->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - his_trade->GetMoney())
+ {
+ _player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
+ my_trade->SetAccepted(false, true);
+ return;
+ }
+
+ if (trader->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - my_trade->GetMoney())
+ {
+ trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
+ his_trade->SetAccepted(false, true);
+ return;
+ }
+
// not accept if some items now can't be trade (cheating)
for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
{
@@ -302,6 +316,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
return;
}
+
if (item->IsBindedNotWith(trader))
{
SendTradeStatus(TRADE_STATUS_NOT_ELIGIBLE);
@@ -458,16 +473,17 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
moveItems(myItems, hisItems);
// logging money
- if (sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
- if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && my_trade->GetMoney() > 0)
+ if (my_trade->GetMoney() > 0)
{
sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
my_trade->GetMoney(),
trader->GetName().c_str(), trader->GetSession()->GetAccountId());
}
- if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && his_trade->GetMoney() > 0)
+
+ if (his_trade->GetMoney() > 0)
{
sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index a64e8117ce9..56e72a10930 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -26,6 +26,7 @@
#include "SpellInfo.h"
#include "Group.h"
#include "Player.h"
+#include "Containers.h"
static Rates const qualityToRate[MAX_ITEM_QUALITY] =
{
@@ -51,10 +52,37 @@ LootStore LootTemplates_Reference("reference_loot_template", "reference
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true);
LootStore LootTemplates_Spell("spell_loot_template", "spell id (random item creating)", false);
+// Selects invalid loot items to be removed from group possible entries (before rolling)
+struct LootGroupInvalidSelector : public std::unary_function<LootStoreItem*, bool>
+{
+ explicit LootGroupInvalidSelector(Loot const& loot, uint16 lootMode) : _loot(loot), _lootMode(lootMode) { }
+
+ bool operator()(LootStoreItem* item) const
+ {
+ if (!(item->lootmode & _lootMode))
+ return true;
+
+ uint8 foundDuplicates = 0;
+ for (std::vector<LootItem>::const_iterator itr = _loot.items.begin(); itr != _loot.items.end(); ++itr)
+ if (itr->itemid == item->itemid)
+ if (++foundDuplicates == _loot.maxDuplicates)
+ return true;
+
+ return false;
+ }
+
+private:
+ Loot const& _loot;
+ uint16 _lootMode;
+};
+
class LootTemplate::LootGroup // A set of loot definitions for items (refs are not allowed)
{
public:
- void AddEntry(LootStoreItem& item); // Adds an entry to the group (at loading stage)
+ LootGroup() { }
+ ~LootGroup();
+
+ void AddEntry(LootStoreItem* item); // Adds an entry to the group (at loading stage)
bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry
bool HasQuestDropForPlayer(Player const* player) const;
// The same for active quests of the player
@@ -72,7 +100,11 @@ class LootTemplate::LootGroup // A set of loot def
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance
- LootStoreItem const* Roll() const; // Rolls an item from the group, returns NULL if all miss their chances
+ LootStoreItem const* Roll(Loot& loot, uint16 lootMode) const; // Rolls an item from the group, returns NULL if all miss their chances
+
+ // This class must never be copied - storing pointers
+ LootGroup(LootGroup const&);
+ LootGroup& operator=(LootGroup const&);
};
//Remove all data and free all memory
@@ -126,10 +158,13 @@ uint32 LootStore::LoadLootTable()
continue; // error already printed to log/console.
}
- LootStoreItem storeitem = LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount);
+ LootStoreItem* storeitem = new LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount);
- if (!storeitem.IsValid(*this, entry)) // Validity checks
+ if (!storeitem->IsValid(*this, entry)) // Validity checks
+ {
+ delete storeitem;
continue;
+ }
// Looking for the template of the entry
// often entries are put together
@@ -139,7 +174,7 @@ uint32 LootStore::LoadLootTable()
tab = m_LootTemplates.find(entry);
if (tab == m_LootTemplates.end())
{
- std::pair< LootTemplateMap::iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate));
+ std::pair< LootTemplateMap::iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate()));
tab = pr.first;
}
}
@@ -182,7 +217,7 @@ void LootStore::ResetConditions()
for (LootTemplateMap::iterator itr = m_LootTemplates.begin(); itr != m_LootTemplates.end(); ++itr)
{
ConditionList empty;
- (*itr).second->CopyConditions(empty);
+ itr->second->CopyConditions(empty);
}
}
@@ -327,7 +362,6 @@ LootItem::LootItem(LootStoreItem const& li)
needs_quest = li.needs_quest;
- count = urand(li.mincountOrRef, li.maxcount); // constructor called for mincountOrRef > 0 only
randomSuffix = GenerateEnchSuffixFactor(itemid);
randomPropertyId = Item::GenerateItemRandomPropertyId(itemid);
is_looted = 0;
@@ -376,26 +410,30 @@ void LootItem::AddAllowedLooter(const Player* player)
//
// Inserts the item into the loot (called by LootTemplate processors)
-void Loot::AddItem(LootStoreItem const & item)
+void Loot::AddItem(LootStoreItem const& item)
{
- if (item.needs_quest) // Quest drop
- {
- if (quest_items.size() < MAX_NR_QUEST_ITEMS)
- quest_items.push_back(LootItem(item));
- }
- else if (items.size() < MAX_NR_LOOT_ITEMS) // Non-quest drop
+ ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item.itemid);
+ if (!proto)
+ return;
+
+ uint32 count = urand(item.mincountOrRef, item.maxcount);
+ uint32 stacks = count / proto->GetMaxStackSize() + (count % proto->GetMaxStackSize() ? 1 : 0);
+
+ std::vector<LootItem>& lootItems = item.needs_quest ? quest_items : items;
+ uint32 limit = item.needs_quest ? MAX_NR_QUEST_ITEMS : MAX_NR_LOOT_ITEMS;
+
+ for (uint32 i = 0; i < stacks && lootItems.size() < limit; ++i)
{
- items.push_back(LootItem(item));
+ LootItem generatedLoot(item);
+ generatedLoot.count = std::min(count, proto->GetMaxStackSize());
+ lootItems.push_back(generatedLoot);
+ count -= proto->GetMaxStackSize();
// non-conditional one-player only items are counted here,
// free for all items are counted in FillFFALoot(),
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
- if (item.conditions.empty())
- {
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item.itemid);
- if (!proto || (proto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT) == 0)
- ++unlootedCount;
- }
+ if (!item.needs_quest && item.conditions.empty() && !(proto->Flags & ITEM_PROTO_FLAG_PARTY_LOOT))
+ ++unlootedCount;
}
}
@@ -1024,34 +1062,56 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
// --------- LootTemplate::LootGroup ---------
//
+LootTemplate::LootGroup::~LootGroup()
+{
+ while (!ExplicitlyChanced.empty())
+ {
+ delete ExplicitlyChanced.back();
+ ExplicitlyChanced.pop_back();
+ }
+
+ while (!EqualChanced.empty())
+ {
+ delete EqualChanced.back();
+ EqualChanced.pop_back();
+ }
+}
+
// Adds an entry to the group (at loading stage)
-void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
+void LootTemplate::LootGroup::AddEntry(LootStoreItem* item)
{
- if (item.chance != 0)
+ if (item->chance != 0)
ExplicitlyChanced.push_back(item);
else
EqualChanced.push_back(item);
}
// Rolls an item from the group, returns NULL if all miss their chances
-LootStoreItem const* LootTemplate::LootGroup::Roll() const
+LootStoreItem const* LootTemplate::LootGroup::Roll(Loot& loot, uint16 lootMode) const
{
- if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked
+ LootStoreItemList possibleLoot = ExplicitlyChanced;
+ possibleLoot.remove_if(LootGroupInvalidSelector(loot, lootMode));
+
+ if (!possibleLoot.empty()) // First explicitly chanced entries are checked
{
- float Roll = (float)rand_chance();
+ float roll = (float)rand_chance();
- for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) // check each explicitly chanced entry in the template and modify its chance based on quality.
+ for (LootStoreItemList::const_iterator itr = possibleLoot.begin(); itr != possibleLoot.end(); ++itr) // check each explicitly chanced entry in the template and modify its chance based on quality.
{
- if (ExplicitlyChanced[i].chance >= 100.0f)
- return &ExplicitlyChanced[i];
+ LootStoreItem* item = *itr;
+ if (item->chance >= 100.0f)
+ return item;
- Roll -= ExplicitlyChanced[i].chance;
- if (Roll < 0)
- return &ExplicitlyChanced[i];
+ roll -= item->chance;
+ if (roll < 0)
+ return item;
}
}
- if (!EqualChanced.empty()) // If nothing selected yet - an item is taken from equal-chanced part
- return &EqualChanced[irand(0, EqualChanced.size()-1)];
+
+ possibleLoot = EqualChanced;
+ possibleLoot.remove_if(LootGroupInvalidSelector(loot, lootMode));
+ if (!possibleLoot.empty()) // If nothing selected yet - an item is taken from equal-chanced part
+ return Trinity::Containers::SelectRandomContainerElement(possibleLoot);
return NULL; // Empty drop from the group
}
@@ -1059,12 +1119,14 @@ LootStoreItem const* LootTemplate::LootGroup::Roll() const
// True if group includes at least 1 quest drop entry
bool LootTemplate::LootGroup::HasQuestDrop() const
{
- for (LootStoreItemList::const_iterator i=ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
- if (i->needs_quest)
+ for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
+ if ((*i)->needs_quest)
return true;
- for (LootStoreItemList::const_iterator i=EqualChanced.begin(); i != EqualChanced.end(); ++i)
- if (i->needs_quest)
+
+ for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i)
+ if ((*i)->needs_quest)
return true;
+
return false;
}
@@ -1072,111 +1134,30 @@ bool LootTemplate::LootGroup::HasQuestDrop() const
bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const* player) const
{
for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
- if (player->HasQuestForItem(i->itemid))
+ if (player->HasQuestForItem((*i)->itemid))
return true;
+
for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i)
- if (player->HasQuestForItem(i->itemid))
+ if (player->HasQuestForItem((*i)->itemid))
return true;
+
return false;
}
void LootTemplate::LootGroup::CopyConditions(ConditionList /*conditions*/)
{
for (LootStoreItemList::iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
- {
- i->conditions.clear();
- }
+ (*i)->conditions.clear();
+
for (LootStoreItemList::iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i)
- {
- i->conditions.clear();
- }
+ (*i)->conditions.clear();
}
// Rolls an item from the group (if any takes its chance) and adds the item to the loot
void LootTemplate::LootGroup::Process(Loot& loot, uint16 lootMode) const
{
- // build up list of possible drops
- LootStoreItemList EqualPossibleDrops = EqualChanced;
- LootStoreItemList ExplicitPossibleDrops = ExplicitlyChanced;
-
- uint8 uiAttemptCount = 0;
- const uint8 uiMaxAttempts = ExplicitlyChanced.size() + EqualChanced.size();
-
- while (!ExplicitPossibleDrops.empty() || !EqualPossibleDrops.empty())
- {
- if (uiAttemptCount == uiMaxAttempts) // already tried rolling too many times, just abort
- return;
-
- LootStoreItem* item = NULL;
-
- // begin rolling (normally called via Roll())
- LootStoreItemList::iterator itr;
- uint8 itemSource = 0;
- if (!ExplicitPossibleDrops.empty()) // First explicitly chanced entries are checked
- {
- itemSource = 1;
- float Roll = (float)rand_chance();
- // check each explicitly chanced entry in the template and modify its chance based on quality
- for (itr = ExplicitPossibleDrops.begin(); itr != ExplicitPossibleDrops.end(); itr = ExplicitPossibleDrops.erase(itr))
- {
- if (itr->chance >= 100.0f)
- {
- item = &*itr;
- break;
- }
-
- Roll -= itr->chance;
- if (Roll < 0)
- {
- item = &*itr;
- break;
- }
- }
- }
- if (item == NULL && !EqualPossibleDrops.empty()) // If nothing selected yet - an item is taken from equal-chanced part
- {
- itemSource = 2;
- itr = EqualPossibleDrops.begin();
- std::advance(itr, irand(0, EqualPossibleDrops.size()-1));
- item = &*itr;
- }
- // finish rolling
-
- ++uiAttemptCount;
-
- if (item != NULL && item->lootmode & lootMode) // only add this item if roll succeeds and the mode matches
- {
- bool duplicate = false;
- if (ItemTemplate const* _proto = sObjectMgr->GetItemTemplate(item->itemid))
- {
- uint8 _item_counter = 0;
- for (LootItemList::const_iterator _item = loot.items.begin(); _item != loot.items.end(); ++_item)
- if (_item->itemid == item->itemid) // search through the items that have already dropped
- {
- ++_item_counter;
- if (_proto->InventoryType == 0 && _item_counter == 3) // Non-equippable items are limited to 3 drops
- duplicate = true;
- else if (_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop
- duplicate = true;
- }
- }
- if (duplicate) // if item->itemid is a duplicate, remove it
- switch (itemSource)
- {
- case 1: // item came from ExplicitPossibleDrops
- ExplicitPossibleDrops.erase(itr);
- break;
- case 2: // item came from EqualPossibleDrops
- EqualPossibleDrops.erase(itr);
- break;
- }
- else // otherwise, add the item and exit the function
- {
- loot.AddItem(*item);
- return;
- }
- }
- }
+ if (LootStoreItem const* item = Roll(loot, lootMode))
+ loot.AddItem(*item);
}
// Overall chance for the group without equal chanced items
@@ -1185,8 +1166,8 @@ float LootTemplate::LootGroup::RawTotalChance() const
float result = 0;
for (LootStoreItemList::const_iterator i=ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
- if (!i->needs_quest)
- result += i->chance;
+ if (!(*i)->needs_quest)
+ result += (*i)->chance;
return result;
}
@@ -1206,37 +1187,35 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
{
float chance = RawTotalChance();
if (chance > 101.0f) // TODO: replace with 100% when DBs will be ready
- {
sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
- }
if (chance >= 100.0f && !EqualChanced.empty())
- {
sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
- }
}
void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, LootIdSet* ref_set) const
{
- for (LootStoreItemList::const_iterator ieItr=ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr)
+ for (LootStoreItemList::const_iterator ieItr = ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr)
{
- if (ieItr->mincountOrRef < 0)
+ LootStoreItem* item = *ieItr;
+ if (item->mincountOrRef < 0)
{
- if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
- LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
+ if (!LootTemplates_Reference.GetLootFor(-item->mincountOrRef))
+ LootTemplates_Reference.ReportNotExistedId(-item->mincountOrRef);
else if (ref_set)
- ref_set->erase(-ieItr->mincountOrRef);
+ ref_set->erase(-item->mincountOrRef);
}
}
- for (LootStoreItemList::const_iterator ieItr=EqualChanced.begin(); ieItr != EqualChanced.end(); ++ieItr)
+ for (LootStoreItemList::const_iterator ieItr = EqualChanced.begin(); ieItr != EqualChanced.end(); ++ieItr)
{
- if (ieItr->mincountOrRef < 0)
+ LootStoreItem* item = *ieItr;
+ if (item->mincountOrRef < 0)
{
- if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
- LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
+ if (!LootTemplates_Reference.GetLootFor(-item->mincountOrRef))
+ LootTemplates_Reference.ReportNotExistedId(-item->mincountOrRef);
else if (ref_set)
- ref_set->erase(-ieItr->mincountOrRef);
+ ref_set->erase(-item->mincountOrRef);
}
}
}
@@ -1245,14 +1224,30 @@ void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, Lo
// --------- LootTemplate ---------
//
+LootTemplate::~LootTemplate()
+{
+ while (!Entries.empty())
+ {
+ delete Entries.back();
+ Entries.pop_back();
+ }
+
+ for (size_t i = 0; i < Groups.size(); ++i)
+ delete Groups[i];
+ Groups.clear();
+}
+
// Adds an entry to the group (at loading stage)
-void LootTemplate::AddEntry(LootStoreItem& item)
+void LootTemplate::AddEntry(LootStoreItem* item)
{
- if (item.group > 0 && item.mincountOrRef > 0) // Group
+ if (item->group > 0 && item->mincountOrRef > 0) // Group
{
- if (item.group >= Groups.size())
- Groups.resize(item.group); // Adds new group the the loot template if needed
- Groups[item.group-1].AddEntry(item); // Adds new entry to the group
+ if (item->group >= Groups.size())
+ Groups.resize(item->group, NULL); // Adds new group the the loot template if needed
+ if (!Groups[item->group - 1])
+ Groups[item->group - 1] = new LootGroup();
+
+ Groups[item->group-1]->AddEntry(item); // Adds new entry to the group
}
else // Non-grouped entries and references are stored together
Entries.push_back(item);
@@ -1261,10 +1256,11 @@ void LootTemplate::AddEntry(LootStoreItem& item)
void LootTemplate::CopyConditions(ConditionList conditions)
{
for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i)
- i->conditions.clear();
+ (*i)->conditions.clear();
for (LootGroups::iterator i = Groups.begin(); i != Groups.end(); ++i)
- i->CopyConditions(conditions);
+ if (LootGroup* group = *i)
+ group->CopyConditions(conditions);
}
void LootTemplate::CopyConditions(LootItem* li) const
@@ -1272,10 +1268,11 @@ void LootTemplate::CopyConditions(LootItem* li) const
// Copies the conditions list from a template item to a LootItem
for (LootStoreItemList::const_iterator _iter = Entries.begin(); _iter != Entries.end(); ++_iter)
{
- if (_iter->itemid != li->itemid)
+ LootStoreItem* item = *_iter;
+ if (item->itemid != li->itemid)
continue;
- li->conditions = _iter->conditions;
+ li->conditions = item->conditions;
break;
}
}
@@ -1288,54 +1285,41 @@ void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId
if (groupId > Groups.size())
return; // Error message already printed at loading stage
- Groups[groupId-1].Process(loot, lootMode);
+ if (!Groups[groupId - 1])
+ return;
+
+ Groups[groupId-1]->Process(loot, lootMode);
return;
}
// Rolling non-grouped items
for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i)
{
- if (i->lootmode &~ lootMode) // Do not add if mode mismatch
+ LootStoreItem* item = *i;
+ if (!(item->lootmode & lootMode)) // Do not add if mode mismatch
continue;
- if (!i->Roll(rate))
- continue; // Bad luck for the entry
+ if (!item->Roll(rate))
+ continue; // Bad luck for the entry
- if (ItemTemplate const* _proto = sObjectMgr->GetItemTemplate(i->itemid))
+ if (item->mincountOrRef < 0) // References processing
{
- uint8 _item_counter = 0;
- LootItemList::const_iterator _item = loot.items.begin();
- for (; _item != loot.items.end(); ++_item)
- if (_item->itemid == i->itemid) // search through the items that have already dropped
- {
- ++_item_counter;
- if (_proto->InventoryType == 0 && _item_counter == 3) // Non-equippable items are limited to 3 drops
- continue;
- else if (_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop
- continue;
- }
- if (_item != loot.items.end())
- continue;
- }
-
- if (i->mincountOrRef < 0) // References processing
- {
- LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
-
+ LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-item->mincountOrRef);
if (!Referenced)
- continue; // Error message already printed at loading stage
+ continue; // Error message already printed at loading stage
- uint32 maxcount = uint32(float(i->maxcount) * sWorld->getRate(RATE_DROP_ITEM_REFERENCED_AMOUNT));
- for (uint32 loop = 0; loop < maxcount; ++loop) // Ref multiplicator
- Referenced->Process(loot, rate, lootMode, i->group);
+ uint32 maxcount = uint32(float(item->maxcount) * sWorld->getRate(RATE_DROP_ITEM_REFERENCED_AMOUNT));
+ for (uint32 loop = 0; loop < maxcount; ++loop) // Ref multiplicator
+ Referenced->Process(loot, rate, lootMode, item->group);
}
- else // Plain entries (not a reference, not grouped)
- loot.AddItem(*i); // Chance is already checked, just add
+ else // Plain entries (not a reference, not grouped)
+ loot.AddItem(*item); // Chance is already checked, just add
}
// Now processing groups
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
- i->Process(loot, lootMode);
+ if (LootGroup* group = *i)
+ group->Process(loot, lootMode);
}
// True if template includes at least 1 quest drop entry
@@ -1345,27 +1329,33 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
{
if (groupId > Groups.size())
return false; // Error message [should be] already printed at loading stage
- return Groups[groupId-1].HasQuestDrop();
+
+ if (!Groups[groupId - 1])
+ return false;
+
+ return Groups[groupId-1]->HasQuestDrop();
}
for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i)
{
- if (i->mincountOrRef < 0) // References
+ LootStoreItem* item = *i;
+ if (item->mincountOrRef < 0) // References
{
- LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
+ LootTemplateMap::const_iterator Referenced = store.find(-item->mincountOrRef);
if (Referenced == store.end())
continue; // Error message [should be] already printed at loading stage
- if (Referenced->second->HasQuestDrop(store, i->group))
+ if (Referenced->second->HasQuestDrop(store, item->group))
return true;
}
- else if (i->needs_quest)
+ else if (item->needs_quest)
return true; // quest drop found
}
// Now processing groups
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
- if (i->HasQuestDrop())
- return true;
+ if (LootGroup* group = *i)
+ if (group->HasQuestDrop())
+ return true;
return false;
}
@@ -1377,28 +1367,34 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
{
if (groupId > Groups.size())
return false; // Error message already printed at loading stage
- return Groups[groupId-1].HasQuestDropForPlayer(player);
+
+ if (!Groups[groupId - 1])
+ return false;
+
+ return Groups[groupId-1]->HasQuestDropForPlayer(player);
}
// Checking non-grouped entries
for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i)
{
- if (i->mincountOrRef < 0) // References processing
+ LootStoreItem* item = *i;
+ if (item->mincountOrRef < 0) // References processing
{
- LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
+ LootTemplateMap::const_iterator Referenced = store.find(-item->mincountOrRef);
if (Referenced == store.end())
continue; // Error message already printed at loading stage
- if (Referenced->second->HasQuestDropForPlayer(store, player, i->group))
+ if (Referenced->second->HasQuestDropForPlayer(store, player, item->group))
return true;
}
- else if (player->HasQuestForItem(i->itemid))
+ else if (player->HasQuestForItem(item->itemid))
return true; // active quest drop found
}
// Now checking groups
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
- if (i->HasQuestDropForPlayer(player))
- return true;
+ if (LootGroup* group = *i)
+ if (group->HasQuestDropForPlayer(player))
+ return true;
return false;
}
@@ -1407,8 +1403,9 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
void LootTemplate::Verify(LootStore const& lootstore, uint32 id) const
{
// Checking group chances
- for (uint32 i=0; i < Groups.size(); ++i)
- Groups[i].Verify(lootstore, id, i+1);
+ for (uint32 i = 0; i < Groups.size(); ++i)
+ if (Groups[i])
+ Groups[i]->Verify(lootstore, id, i + 1);
// TODO: References validity checks
}
@@ -1417,18 +1414,21 @@ void LootTemplate::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_se
{
for (LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr)
{
- if (ieItr->mincountOrRef < 0)
+ LootStoreItem* item = *ieItr;
+ if (item->mincountOrRef < 0)
{
- if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
- LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
+ if (!LootTemplates_Reference.GetLootFor(-item->mincountOrRef))
+ LootTemplates_Reference.ReportNotExistedId(-item->mincountOrRef);
else if (ref_set)
- ref_set->erase(-ieItr->mincountOrRef);
+ ref_set->erase(-item->mincountOrRef);
}
}
for (LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr)
- grItr->CheckLootRefs(store, ref_set);
+ if (LootGroup* group = *grItr)
+ group->CheckLootRefs(store, ref_set);
}
+
bool LootTemplate::addConditionItem(Condition* cond)
{
if (!cond || !cond->isLoaded())//should never happen, checked at loading
@@ -1436,41 +1436,48 @@ bool LootTemplate::addConditionItem(Condition* cond)
sLog->outError(LOG_FILTER_LOOT, "LootTemplate::addConditionItem: condition is null");
return false;
}
+
if (!Entries.empty())
{
for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i)
{
- if (i->itemid == uint32(cond->SourceEntry))
+ if ((*i)->itemid == uint32(cond->SourceEntry))
{
- i->conditions.push_back(cond);
+ (*i)->conditions.push_back(cond);
return true;
}
}
}
+
if (!Groups.empty())
{
for (LootGroups::iterator groupItr = Groups.begin(); groupItr != Groups.end(); ++groupItr)
{
- LootStoreItemList* itemList = (*groupItr).GetExplicitlyChancedItemList();
+ LootGroup* group = *groupItr;
+ if (!group)
+ continue;
+
+ LootStoreItemList* itemList = group->GetExplicitlyChancedItemList();
if (!itemList->empty())
{
for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i)
{
- if ((*i).itemid == uint32(cond->SourceEntry))
+ if ((*i)->itemid == uint32(cond->SourceEntry))
{
- (*i).conditions.push_back(cond);
+ (*i)->conditions.push_back(cond);
return true;
}
}
}
- itemList = (*groupItr).GetEqualChancedItemList();
+
+ itemList = group->GetEqualChancedItemList();
if (!itemList->empty())
{
for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i)
{
- if ((*i).itemid == uint32(cond->SourceEntry))
+ if ((*i)->itemid == uint32(cond->SourceEntry))
{
- (*i).conditions.push_back(cond);
+ (*i)->conditions.push_back(cond);
return true;
}
}
@@ -1483,10 +1490,9 @@ bool LootTemplate::addConditionItem(Condition* cond)
bool LootTemplate::isReference(uint32 id)
{
for (LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr)
- {
- if (ieItr->itemid == id && ieItr->mincountOrRef < 0)
+ if ((*ieItr)->itemid == id && (*ieItr)->mincountOrRef < 0)
return true;
- }
+
return false;//not found or not reference
}
@@ -1521,7 +1527,7 @@ void LoadLootTemplates_Creature()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
}
void LoadLootTemplates_Disenchant()
@@ -1554,7 +1560,7 @@ void LoadLootTemplates_Disenchant()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
}
void LoadLootTemplates_Fishing()
@@ -1578,7 +1584,7 @@ void LoadLootTemplates_Fishing()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
}
void LoadLootTemplates_Gameobject()
@@ -1612,7 +1618,7 @@ void LoadLootTemplates_Gameobject()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
}
void LoadLootTemplates_Item()
@@ -1636,7 +1642,7 @@ void LoadLootTemplates_Item()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
}
void LoadLootTemplates_Milling()
@@ -1665,7 +1671,7 @@ void LoadLootTemplates_Milling()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
}
void LoadLootTemplates_Pickpocketing()
@@ -1699,7 +1705,7 @@ void LoadLootTemplates_Pickpocketing()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
}
void LoadLootTemplates_Prospecting()
@@ -1728,7 +1734,7 @@ void LoadLootTemplates_Prospecting()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
}
void LoadLootTemplates_Mail()
@@ -1752,7 +1758,7 @@ void LoadLootTemplates_Mail()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
}
void LoadLootTemplates_Skinning()
@@ -1786,7 +1792,7 @@ void LoadLootTemplates_Skinning()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
}
void LoadLootTemplates_Spell()
@@ -1828,7 +1834,7 @@ void LoadLootTemplates_Spell()
if (count)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
}
void LoadLootTemplates_Reference()
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 759064385a5..5c858a35242 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -27,6 +27,7 @@
#include <map>
#include <vector>
+#include <list>
enum RollType
{
@@ -174,7 +175,7 @@ class LootTemplate;
typedef std::vector<QuestItem> QuestItemList;
typedef std::vector<LootItem> LootItemList;
typedef std::map<uint32, QuestItemList*> QuestItemMap;
-typedef std::vector<LootStoreItem> LootStoreItemList;
+typedef std::list<LootStoreItem*> LootStoreItemList;
typedef UNORDERED_MAP<uint32, LootTemplate*> LootTemplateMap;
typedef std::set<uint32> LootIdSet;
@@ -218,11 +219,14 @@ class LootStore
class LootTemplate
{
class LootGroup; // A set of loot definitions for items (refs are not allowed inside)
- typedef std::vector<LootGroup> LootGroups;
+ typedef std::vector<LootGroup*> LootGroups;
public:
+ LootTemplate() { }
+ ~LootTemplate();
+
// Adds an entry to the group (at loading stage)
- void AddEntry(LootStoreItem& item);
+ void AddEntry(LootStoreItem* item);
// Rolls for every item in the template and adds the rolled items the the loot
void Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId = 0) const;
void CopyConditions(ConditionList conditions);
@@ -242,6 +246,10 @@ class LootTemplate
private:
LootStoreItemList Entries; // not grouped only
LootGroups Groups; // groups have own (optimised) processing, grouped entries go there
+
+ // Objects of this class must never be copied, we are storing pointers in container
+ LootTemplate(LootTemplate const&);
+ LootTemplate& operator=(LootTemplate const&);
};
//=====================================================
@@ -290,12 +298,13 @@ struct Loot
uint8 unlootedCount;
uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
LootType loot_type; // required for achievement system
+ uint8 maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3)
// GUIDLow of container that holds this loot (item_instance.entry)
// Only set for inventory items that can be right-click looted
uint32 containerID;
- Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE), containerID(0) {}
+ Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) {}
~Loot() { clear(); }
// For deleting items at loot removal since there is no backward interface to the Item()
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 9e6735efc26..3d6285a806c 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -26,7 +26,6 @@
#include "GridStates.h"
#include "Group.h"
#include "InstanceScript.h"
-#include "LFGMgr.h"
#include "MapInstanced.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
@@ -37,12 +36,6 @@
#include "Vehicle.h"
#include "VMapFactory.h"
-union u_map_magic
-{
- char asChar[4];
- uint32 asUInt;
-};
-
u_map_magic MapMagic = { {'M','A','P','S'} };
u_map_magic MapVersionMagic = { {'v','1','.','3'} };
u_map_magic MapAreaMagic = { {'A','R','E','A'} };
@@ -78,28 +71,30 @@ Map::~Map()
bool Map::ExistMap(uint32 mapid, int gx, int gy)
{
- int len = sWorld->GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1;
- char* tmp = new char[len];
- snprintf(tmp, len, (char *)(sWorld->GetDataPath()+"maps/%03u%02u%02u.map").c_str(), mapid, gx, gy);
+ int len = sWorld->GetDataPath().length() + strlen("maps/%03u%02u%02u.map") + 1;
+ char* fileName = new char[len];
+ snprintf(fileName, len, (char *)(sWorld->GetDataPath() + "maps/%03u%02u%02u.map").c_str(), mapid, gx, gy);
bool ret = false;
- FILE* pf=fopen(tmp, "rb");
+ FILE* pf = fopen(fileName, "rb");
if (!pf)
- sLog->outError(LOG_FILTER_MAPS, "Map file '%s': does not exist!", tmp);
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s': does not exist!", fileName);
else
{
map_fileheader header;
if (fread(&header, sizeof(header), 1, pf) == 1)
{
- if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic.asUInt)
- sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp);
+ if (header.mapMagic.asUInt != MapMagic.asUInt || header.versionMagic.asUInt != MapVersionMagic.asUInt)
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please recreate using the mapextractor.",
+ fileName, 4, header.mapMagic.asChar, 4, header.versionMagic.asChar, 4, MapMagic.asChar, 4, MapVersionMagic.asChar);
else
ret = true;
}
fclose(pf);
}
- delete [] tmp;
+
+ delete[] fileName;
return ret;
}
@@ -1103,23 +1098,23 @@ bool GridMap::loadData(char* filename)
return false;
}
- if (header.mapMagic == MapMagic.asUInt && header.versionMagic == MapVersionMagic.asUInt)
+ if (header.mapMagic.asUInt == MapMagic.asUInt && header.versionMagic.asUInt == MapVersionMagic.asUInt)
{
- // loadup area data
+ // load up area data
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
{
sLog->outError(LOG_FILTER_MAPS, "Error loading map area data\n");
fclose(in);
return false;
}
- // loadup height data
+ // load up height data
if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize))
{
sLog->outError(LOG_FILTER_MAPS, "Error loading map height data\n");
fclose(in);
return false;
}
- // loadup liquid data
+ // load up liquid data
if (header.liquidMapOffset && !loadLiquidData(in, header.liquidMapOffset, header.liquidMapSize))
{
sLog->outError(LOG_FILTER_MAPS, "Error loading map liquids data\n");
@@ -1129,7 +1124,9 @@ bool GridMap::loadData(char* filename)
fclose(in);
return true;
}
- sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", filename);
+
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please recreate using the mapextractor.",
+ filename, 4, header.mapMagic.asChar, 4, header.versionMagic.asChar, 4, MapMagic.asChar, 4, MapVersionMagic.asChar);
fclose(in);
return false;
}
@@ -1920,10 +1917,10 @@ bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, floa
bool Map::getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
{
- Vector3 startPos = Vector3(x1, y1, z1);
- Vector3 dstPos = Vector3(x2, y2, z2);
+ G3D::Vector3 startPos(x1, y1, z1);
+ G3D::Vector3 dstPos(x2, y2, z2);
- Vector3 resultPos;
+ G3D::Vector3 resultPos;
bool result = _dynamicTree.getObjectHitPos(phasemask, startPos, dstPos, resultPos, modifyDist);
rx = resultPos.x;
@@ -2484,13 +2481,6 @@ bool InstanceMap::AddPlayerToMap(Player* player)
ASSERT(playerBind->save == mapSave);
}
}
-
- if (group && group->isLFGGroup())
- if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
- if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId))
- if (LFGDungeonData const* randomDungeon = sLFGMgr->GetLFGDungeon(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin())))
- if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM)
- player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
}
// for normal instances cancel the reset schedule when the
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index c9686d36a42..cc47f053827 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -58,8 +58,15 @@ struct ScriptAction
{
uint64 sourceGUID;
uint64 targetGUID;
- uint64 ownerGUID; // owner of source if source is item
- ScriptInfo const* script; // pointer to static script data
+ uint64 ownerGUID; ///> owner of source if source is item
+ ScriptInfo const* script; ///> pointer to static script data
+};
+
+/// Represents a map magic value of 4 bytes (used in versions)
+union u_map_magic
+{
+ char asChar[4]; ///> Non-null terminated string
+ uint32 asUInt; ///> uint32 representation
};
// ******************************************
@@ -67,9 +74,9 @@ struct ScriptAction
// ******************************************
struct map_fileheader
{
- uint32 mapMagic;
- uint32 versionMagic;
- uint32 buildMagic;
+ u_map_magic mapMagic;
+ u_map_magic versionMagic;
+ u_map_magic buildMagic;
uint32 areaMapOffset;
uint32 areaMapSize;
uint32 heightMapOffset;
@@ -428,6 +435,7 @@ class Map : public GridRefManager<NGridType>
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);
+ void SummonCreatureGroup(uint8 group, std::list<TempSummon*>& list);
Creature* GetCreature(uint64 guid);
GameObject* GetGameObject(uint64 guid);
DynamicObject* GetDynamicObject(uint64 guid);
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index 755d443091a..f44a9dd865f 100644
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
@@ -105,16 +105,17 @@ Map* MapManager::CreateBaseMap(uint32 id)
{
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
- const MapEntry* entry = sMapStore.LookupEntry(id);
- if (entry && entry->Instanceable())
- {
+ MapEntry const* entry = sMapStore.LookupEntry(id);
+ ASSERT(entry);
+
+ if (entry->Instanceable())
map = new MapInstanced(id, i_gridCleanUpDelay);
- }
else
{
map = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
map->LoadRespawnTimes();
}
+
i_maps[id] = map;
}
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index b0a461d7760..6579485a56f 100644
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
@@ -39,7 +39,8 @@ namespace Trinity
{
return uint32(ceil(hk_honor_at_level_f(level, multiplier)));
}
- }
+ } // namespace Trinity::Honor
+
namespace XP
{
inline uint8 GetGrayLevel(uint8 pl_level)
@@ -219,7 +220,7 @@ namespace Trinity
sScriptMgr->OnGroupRateCalculation(rate, count, isRaid);
return rate;
}
- }
-}
+ } // namespace Trinity::XP
+} // namespace Trinity
#endif
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 1aeb16e9c7e..28f7a2cb8a0 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -86,7 +86,40 @@ enum TrinityStrings
LANG_CONNECTED_PLAYERS = 60,
LANG_ACCOUNT_ADDON = 61,
LANG_IMPROPER_VALUE = 62,
- // Room for more level 0 63-99 not used
+ LANG_RBAC_WRONG_PARAMETER_ID = 63,
+ LANG_RBAC_WRONG_PARAMETER_REALM = 64,
+ LANG_RBAC_GROUP_IN_LIST = 65,
+ LANG_RBAC_GROUP_NOT_IN_LIST = 66,
+ LANG_RBAC_GROUP_ADDED = 67,
+ LANG_RBAC_GROUP_REMOVED = 68,
+ LANG_RBAC_GROUP_LIST_HEADER = 69,
+ LANG_RBAC_LIST_EMPTY = 70,
+ LANG_RBAC_LIST_ELEMENT = 71,
+ LANG_RBAC_ROLE_GRANTED_IN_LIST = 72,
+ LANG_RBAC_ROLE_GRANTED_IN_DENIED_LIST = 73,
+ LANG_RBAC_ROLE_GRANTED = 74,
+ LANG_RBAC_ROLE_DENIED_IN_LIST = 75,
+ LANG_RBAC_ROLE_DENIED_IN_GRANTED_LIST = 76,
+ LANG_RBAC_ROLE_DENIED = 77,
+ LANG_RBAC_ROLE_REVOKED = 78,
+ LANG_RBAC_ROLE_REVOKED_NOT_IN_LIST = 79,
+ LANG_RBAC_ROLE_LIST_HEADER_GRANTED = 80,
+ LANG_RBAC_ROLE_LIST_HEADER_DENIED = 81,
+ LANG_RBAC_PERM_GRANTED_IN_LIST = 82,
+ LANG_RBAC_PERM_GRANTED_IN_DENIED_LIST = 83,
+ LANG_RBAC_PERM_GRANTED = 84,
+ LANG_RBAC_PERM_DENIED_IN_LIST = 85,
+ LANG_RBAC_PERM_DENIED_IN_GRANTED_LIST = 86,
+ LANG_RBAC_PERM_DENIED = 87,
+ LANG_RBAC_PERM_REVOKED = 88,
+ LANG_RBAC_PERM_REVOKED_NOT_IN_LIST = 89,
+ LANG_RBAC_PERM_LIST_HEADER_GRANTED = 90,
+ LANG_RBAC_PERM_LIST_HEADER_DENIED = 91,
+ LANG_RBAC_PERM_LIST_GLOBAL = 92,
+ LANG_RBAC_LIST_GROUPS_HEADER = 93,
+ LANG_RBAC_LIST_ROLES_HEADER = 94,
+ LANG_RBAC_LIST_PERMISSIONS_HEADER = 95,
+ // Room for more level 0 96-99 not used
// level 1 chat
LANG_GLOBAL_NOTIFY = 100,
@@ -522,6 +555,7 @@ enum TrinityStrings
LANG_PINFO_BAN = 453,
LANG_PINFO_MAP_ONLINE = 714,
LANG_PINFO_MAP_OFFLINE = 716,
+ LANG_PINFO_GUILD_INFO = 749,
LANG_YOU_SET_EXPLORE_ALL = 551,
LANG_YOU_SET_EXPLORE_NOTHING = 552,
@@ -851,7 +885,9 @@ enum TrinityStrings
LANG_GROUP_PLAYER_JOINED = 1146,
LANG_GROUP_NOT_IN_GROUP = 1147,
LANG_GROUP_FULL = 1148,
- // Room for more level 3 1149-1199 not used
+ LANG_GROUP_TYPE = 1149,
+ LANG_GROUP_PLAYER_NAME_GUID = 1150,
+ // Room for more level 3 1151-1199 not used
// Debug commands
LANG_CINEMATIC_NOT_EXIST = 1200,
@@ -997,7 +1033,8 @@ enum TrinityStrings
LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033,
LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034,
LANG_CALL_FOR_HELP = 5035,
- // Room for more Trinity strings 5036-9999
+ LANG_NPCINFO_EQUIPMENT = 5036,
+ // Room for more Trinity strings 5037-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 6f25f50ed50..6f60aec4beb 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -489,7 +489,7 @@ enum SpellAttr6
SPELL_ATTR6_UNK3 = 0x00000008, // 3
SPELL_ATTR6_UNK4 = 0x00000010, // 4
SPELL_ATTR6_UNK5 = 0x00000020, // 5
- SPELL_ATTR6_UNK6 = 0x00000040, // 6
+ SPELL_ATTR6_PRINT_SPELLNAME = 0x00000040, // 6 when activated, spell name is shown at the center of the screen: <Spell name> (client-side attribute)
SPELL_ATTR6_UNK7 = 0x00000080, // 7
SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED = 0x00000100, // 8
SPELL_ATTR6_UNK9 = 0x00000200, // 9
@@ -3157,124 +3157,129 @@ enum SummonType
enum EventId
{
EVENT_CHARGE = 1003,
- EVENT_JUMP = 1004
+ EVENT_JUMP = 1004,
+
+ /// Special charge event which is used for charge spells that have explicit targets
+ /// and had a path already generated - using it in PointMovementGenerator will not
+ /// create a new spline and launch it
+ EVENT_CHARGE_PREPATH = 1005
};
enum ResponseCodes
{
- RESPONSE_SUCCESS = 0x00,
- RESPONSE_FAILURE = 0x01,
- RESPONSE_CANCELLED = 0x02,
- RESPONSE_DISCONNECTED = 0x03,
- RESPONSE_FAILED_TO_CONNECT = 0x04,
- RESPONSE_CONNECTED = 0x05,
- RESPONSE_VERSION_MISMATCH = 0x06,
-
- CSTATUS_CONNECTING = 0x07,
- CSTATUS_NEGOTIATING_SECURITY = 0x08,
- CSTATUS_NEGOTIATION_COMPLETE = 0x09,
- CSTATUS_NEGOTIATION_FAILED = 0x0A,
- CSTATUS_AUTHENTICATING = 0x0B,
-
- AUTH_OK = 0x0C,
- AUTH_FAILED = 0x0D,
- AUTH_REJECT = 0x0E,
- AUTH_BAD_SERVER_PROOF = 0x0F,
- AUTH_UNAVAILABLE = 0x10,
- AUTH_SYSTEM_ERROR = 0x11,
- AUTH_BILLING_ERROR = 0x12,
- AUTH_BILLING_EXPIRED = 0x13,
- AUTH_VERSION_MISMATCH = 0x14,
- AUTH_UNKNOWN_ACCOUNT = 0x15,
- AUTH_INCORRECT_PASSWORD = 0x16,
- AUTH_SESSION_EXPIRED = 0x17,
- AUTH_SERVER_SHUTTING_DOWN = 0x18,
- AUTH_ALREADY_LOGGING_IN = 0x19,
- AUTH_LOGIN_SERVER_NOT_FOUND = 0x1A,
- AUTH_WAIT_QUEUE = 0x1B,
- AUTH_BANNED = 0x1C,
- AUTH_ALREADY_ONLINE = 0x1D,
- AUTH_NO_TIME = 0x1E,
- AUTH_DB_BUSY = 0x1F,
- AUTH_SUSPENDED = 0x20,
- AUTH_PARENTAL_CONTROL = 0x21,
- AUTH_LOCKED_ENFORCED = 0x22,
-
- REALM_LIST_IN_PROGRESS = 0x23,
- REALM_LIST_SUCCESS = 0x24,
- REALM_LIST_FAILED = 0x25,
- REALM_LIST_INVALID = 0x26,
- REALM_LIST_REALM_NOT_FOUND = 0x27,
-
- ACCOUNT_CREATE_IN_PROGRESS = 0x28,
- ACCOUNT_CREATE_SUCCESS = 0x29,
- ACCOUNT_CREATE_FAILED = 0x2A,
-
- CHAR_LIST_RETRIEVING = 0x2B,
- CHAR_LIST_RETRIEVED = 0x2C,
- CHAR_LIST_FAILED = 0x2D,
-
- CHAR_CREATE_IN_PROGRESS = 0x2E,
- CHAR_CREATE_SUCCESS = 0x2F,
- CHAR_CREATE_ERROR = 0x30,
- CHAR_CREATE_FAILED = 0x31,
- CHAR_CREATE_NAME_IN_USE = 0x32,
- CHAR_CREATE_DISABLED = 0x33,
- CHAR_CREATE_PVP_TEAMS_VIOLATION = 0x34,
- CHAR_CREATE_SERVER_LIMIT = 0x35,
- CHAR_CREATE_ACCOUNT_LIMIT = 0x36,
- CHAR_CREATE_SERVER_QUEUE = 0x37,
- CHAR_CREATE_ONLY_EXISTING = 0x38,
- CHAR_CREATE_EXPANSION = 0x39,
- CHAR_CREATE_EXPANSION_CLASS = 0x3A,
- CHAR_CREATE_LEVEL_REQUIREMENT = 0x3B,
- CHAR_CREATE_UNIQUE_CLASS_LIMIT = 0x3C,
- CHAR_CREATE_CHARACTER_IN_GUILD = 0x3D,
- CHAR_CREATE_RESTRICTED_RACECLASS = 0x3E,
- CHAR_CREATE_CHARACTER_CHOOSE_RACE = 0x3F,
- CHAR_CREATE_CHARACTER_ARENA_LEADER = 0x40,
- CHAR_CREATE_CHARACTER_DELETE_MAIL = 0x41,
- CHAR_CREATE_CHARACTER_SWAP_FACTION = 0x42,
- CHAR_CREATE_CHARACTER_RACE_ONLY = 0x43,
- CHAR_CREATE_CHARACTER_GOLD_LIMIT = 0x44,
- CHAR_CREATE_FORCE_LOGIN = 0x45,
-
- CHAR_DELETE_IN_PROGRESS = 0x46,
- CHAR_DELETE_SUCCESS = 0x47,
- CHAR_DELETE_FAILED = 0x48,
- CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 0x49,
- CHAR_DELETE_FAILED_GUILD_LEADER = 0x4A,
- CHAR_DELETE_FAILED_ARENA_CAPTAIN = 0x4B,
-
- CHAR_LOGIN_IN_PROGRESS = 0x4C,
- CHAR_LOGIN_SUCCESS = 0x4D,
- CHAR_LOGIN_NO_WORLD = 0x4E,
- CHAR_LOGIN_DUPLICATE_CHARACTER = 0x4F,
- CHAR_LOGIN_NO_INSTANCES = 0x50,
- CHAR_LOGIN_FAILED = 0x51,
- CHAR_LOGIN_DISABLED = 0x52,
- CHAR_LOGIN_NO_CHARACTER = 0x53,
- CHAR_LOGIN_LOCKED_FOR_TRANSFER = 0x54,
- CHAR_LOGIN_LOCKED_BY_BILLING = 0x55,
- CHAR_LOGIN_LOCKED_BY_MOBILE_AH = 0x56,
-
- CHAR_NAME_SUCCESS = 0x57,
- CHAR_NAME_FAILURE = 0x58,
- CHAR_NAME_NO_NAME = 0x59,
- CHAR_NAME_TOO_SHORT = 0x5A,
- CHAR_NAME_TOO_LONG = 0x5B,
- CHAR_NAME_INVALID_CHARACTER = 0x5C,
- CHAR_NAME_MIXED_LANGUAGES = 0x5D,
- CHAR_NAME_PROFANE = 0x5E,
- CHAR_NAME_RESERVED = 0x5F,
- CHAR_NAME_INVALID_APOSTROPHE = 0x60,
- CHAR_NAME_MULTIPLE_APOSTROPHES = 0x61,
- CHAR_NAME_THREE_CONSECUTIVE = 0x62,
- CHAR_NAME_INVALID_SPACE = 0x63,
- CHAR_NAME_CONSECUTIVE_SPACES = 0x64,
- CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 0x65,
- CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 0x66,
- CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x67
+ RESPONSE_SUCCESS = 0,
+ RESPONSE_FAILURE = 1,
+ RESPONSE_CANCELLED = 2,
+ RESPONSE_DISCONNECTED = 3,
+ RESPONSE_FAILED_TO_CONNECT = 4,
+ RESPONSE_CONNECTED = 5,
+ RESPONSE_VERSION_MISMATCH = 6,
+
+ CSTATUS_CONNECTING = 7,
+ CSTATUS_NEGOTIATING_SECURITY = 8,
+ CSTATUS_NEGOTIATION_COMPLETE = 9,
+ CSTATUS_NEGOTIATION_FAILED = 10,
+ CSTATUS_AUTHENTICATING = 11,
+
+ AUTH_OK = 12,
+ AUTH_FAILED = 13,
+ AUTH_REJECT = 14,
+ AUTH_BAD_SERVER_PROOF = 15,
+ AUTH_UNAVAILABLE = 16,
+ AUTH_SYSTEM_ERROR = 17,
+ AUTH_BILLING_ERROR = 18,
+ AUTH_BILLING_EXPIRED = 19,
+ AUTH_VERSION_MISMATCH = 20,
+ AUTH_UNKNOWN_ACCOUNT = 21,
+ AUTH_INCORRECT_PASSWORD = 22,
+ AUTH_SESSION_EXPIRED = 23,
+ AUTH_SERVER_SHUTTING_DOWN = 24,
+ AUTH_ALREADY_LOGGING_IN = 25,
+ AUTH_LOGIN_SERVER_NOT_FOUND = 26,
+ AUTH_WAIT_QUEUE = 27,
+ AUTH_BANNED = 28,
+ AUTH_ALREADY_ONLINE = 29,
+ AUTH_NO_TIME = 30,
+ AUTH_DB_BUSY = 31,
+ AUTH_SUSPENDED = 32,
+ AUTH_PARENTAL_CONTROL = 33,
+ AUTH_LOCKED_ENFORCED = 34,
+
+ REALM_LIST_IN_PROGRESS = 35,
+ REALM_LIST_SUCCESS = 36,
+ REALM_LIST_FAILED = 37,
+ REALM_LIST_INVALID = 38,
+ REALM_LIST_REALM_NOT_FOUND = 39,
+
+ ACCOUNT_CREATE_IN_PROGRESS = 40,
+ ACCOUNT_CREATE_SUCCESS = 41,
+ ACCOUNT_CREATE_FAILED = 42,
+
+ CHAR_LIST_RETRIEVING = 43,
+ CHAR_LIST_RETRIEVED = 44,
+ CHAR_LIST_FAILED = 45,
+
+ CHAR_CREATE_IN_PROGRESS = 46,
+ CHAR_CREATE_SUCCESS = 47,
+ CHAR_CREATE_ERROR = 48,
+ CHAR_CREATE_FAILED = 49,
+ CHAR_CREATE_NAME_IN_USE = 50,
+ CHAR_CREATE_DISABLED = 51,
+ CHAR_CREATE_PVP_TEAMS_VIOLATION = 52,
+ CHAR_CREATE_SERVER_LIMIT = 53,
+ CHAR_CREATE_ACCOUNT_LIMIT = 54,
+ CHAR_CREATE_SERVER_QUEUE = 55,
+ CHAR_CREATE_ONLY_EXISTING = 56,
+ CHAR_CREATE_EXPANSION = 57,
+ CHAR_CREATE_EXPANSION_CLASS = 58,
+ CHAR_CREATE_LEVEL_REQUIREMENT = 59,
+ CHAR_CREATE_UNIQUE_CLASS_LIMIT = 60,
+ CHAR_CREATE_CHARACTER_IN_GUILD = 61,
+ CHAR_CREATE_RESTRICTED_RACECLASS = 62,
+ CHAR_CREATE_CHARACTER_CHOOSE_RACE = 63,
+ CHAR_CREATE_CHARACTER_ARENA_LEADER = 64,
+ CHAR_CREATE_CHARACTER_DELETE_MAIL = 65,
+ CHAR_CREATE_CHARACTER_SWAP_FACTION = 66,
+ CHAR_CREATE_CHARACTER_RACE_ONLY = 67,
+ CHAR_CREATE_CHARACTER_GOLD_LIMIT = 68,
+ CHAR_CREATE_FORCE_LOGIN = 69,
+
+ CHAR_DELETE_IN_PROGRESS = 70,
+ CHAR_DELETE_SUCCESS = 71,
+ CHAR_DELETE_FAILED = 72,
+ CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER = 73,
+ CHAR_DELETE_FAILED_GUILD_LEADER = 74,
+ CHAR_DELETE_FAILED_ARENA_CAPTAIN = 75,
+
+ CHAR_LOGIN_IN_PROGRESS = 76,
+ CHAR_LOGIN_SUCCESS = 77,
+ CHAR_LOGIN_NO_WORLD = 78,
+ CHAR_LOGIN_DUPLICATE_CHARACTER = 79,
+ CHAR_LOGIN_NO_INSTANCES = 80,
+ CHAR_LOGIN_FAILED = 81,
+ CHAR_LOGIN_DISABLED = 82,
+ CHAR_LOGIN_NO_CHARACTER = 83,
+ CHAR_LOGIN_LOCKED_FOR_TRANSFER = 84,
+ CHAR_LOGIN_LOCKED_BY_BILLING = 85,
+ CHAR_LOGIN_LOCKED_BY_MOBILE_AH = 86,
+
+ CHAR_NAME_SUCCESS = 87,
+ CHAR_NAME_FAILURE = 88,
+ CHAR_NAME_NO_NAME = 89,
+ CHAR_NAME_TOO_SHORT = 90,
+ CHAR_NAME_TOO_LONG = 91,
+ CHAR_NAME_INVALID_CHARACTER = 92,
+ CHAR_NAME_MIXED_LANGUAGES = 93,
+ CHAR_NAME_PROFANE = 94,
+ CHAR_NAME_RESERVED = 95,
+ CHAR_NAME_INVALID_APOSTROPHE = 96,
+ CHAR_NAME_MULTIPLE_APOSTROPHES = 97,
+ CHAR_NAME_THREE_CONSECUTIVE = 98,
+ CHAR_NAME_INVALID_SPACE = 99,
+ CHAR_NAME_CONSECUTIVE_SPACES = 100,
+ CHAR_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 101,
+ CHAR_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 102,
+ CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 103
};
/// Ban function modes
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index c9ca7772186..8e045b98dbb 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -424,15 +424,16 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
}
}
-void MotionMaster::MoveCharge(PathGenerator path, float speed, uint32 id)
+void MotionMaster::MoveCharge(PathGenerator const& path)
{
Vector3 dest = path.GetActualEndPosition();
- MoveCharge(dest.x, dest.y, dest.z, speed, id);
+ MoveCharge(dest.x, dest.y, dest.z, SPEED_CHARGE, EVENT_CHARGE_PREPATH);
+ // Charge movement is not started when using EVENT_CHARGE_PREPATH
Movement::MoveSplineInit init(_owner);
init.MovebyPath(path.GetPath());
- init.SetVelocity(speed);
+ init.SetVelocity(SPEED_CHARGE);
init.Launch();
}
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index 4b6075aac10..f2f3959dba5 100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -162,7 +162,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
void MoveTakeoff(uint32 id, Position const& pos);
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false);
- void MoveCharge(PathGenerator path, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE);
+ void MoveCharge(PathGenerator const& path);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
void MoveJumpTo(float angle, float speedXY, float speedZ);
void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP)
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index 06b2315f294..ea7a8c4c710 100755
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -34,7 +34,7 @@ void PointMovementGenerator<T>::DoInitialize(T* unit)
unit->AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
- if (id == EVENT_CHARGE)
+ if (id == EVENT_CHARGE_PREPATH)
return;
Movement::MoveSplineInit init(unit);
@@ -58,7 +58,7 @@ bool PointMovementGenerator<T>::DoUpdate(T* unit, uint32 /*diff*/)
unit->AddUnitState(UNIT_STATE_ROAMING_MOVE);
- if (id != EVENT_CHARGE && i_recalculateSpeed && !unit->movespline->Finalized())
+ if (id != EVENT_CHARGE_PREPATH && i_recalculateSpeed && !unit->movespline->Finalized())
{
i_recalculateSpeed = false;
Movement::MoveSplineInit init(unit);
@@ -128,8 +128,6 @@ void EffectMovementGenerator::Finalize(Unit* unit)
if (unit->GetTypeId() != TYPEID_UNIT)
return;
- if (unit->ToCreature()->AI())
- unit->ToCreature()->AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id);
// Need restore previous movement since we have no proper states system
if (unit->isAlive() && !unit->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING))
{
@@ -138,4 +136,7 @@ void EffectMovementGenerator::Finalize(Unit* unit)
else
unit->GetMotionMaster()->Initialize();
}
+
+ if (unit->ToCreature()->AI())
+ unit->ToCreature()->AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id);
}
diff --git a/src/server/game/Movement/PathGenerator.h b/src/server/game/Movement/PathGenerator.h
index a20f900b584..d41d3160db5 100644
--- a/src/server/game/Movement/PathGenerator.h
+++ b/src/server/game/Movement/PathGenerator.h
@@ -55,7 +55,7 @@ enum PathType
class PathGenerator
{
public:
- PathGenerator(Unit const* owner);
+ explicit PathGenerator(Unit const* owner);
~PathGenerator();
// Calculate the path from owner to given destination
@@ -71,7 +71,7 @@ class PathGenerator
Vector3 const& GetEndPosition() const { return _endPosition; }
Vector3 const& GetActualEndPosition() const { return _actualEndPosition; }
- PointsArray& GetPath() { return _pathPoints; }
+ PointsArray const& GetPath() const { return _pathPoints; }
PathType GetPathType() const { return _type; }
private:
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index 1e4d4950ea0..e661cf877e3 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -158,7 +158,7 @@ namespace Movement
{
PathGenerator path(unit);
bool result = path.CalculatePath(dest.x, dest.y, dest.z, forceDestination);
- if (result && path.GetPathType() & ~PATHFIND_NOPATH)
+ if (result && !(path.GetPathType() & PATHFIND_NOPATH))
{
MovebyPath(path.GetPath());
return;
diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
index 7133fc50e9f..29d1bb50a8f 100644
--- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
+++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
@@ -145,7 +146,7 @@ namespace Movement
//data.append<float>(&mov.m_float_values[SpeedWalk], SpeedMaxCount);
//if (mov.SplineEnabled())
{
- MoveSplineFlag splineFlags = move_spline.splineflags;
+ MoveSplineFlag const& splineFlags = move_spline.splineflags;
data << splineFlags.raw();
diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.h b/src/server/game/Movement/Spline/MovementPacketBuilder.h
index 92a414e9b3b..b502e203656 100644
--- a/src/server/game/Movement/Spline/MovementPacketBuilder.h
+++ b/src/server/game/Movement/Spline/MovementPacketBuilder.h
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 6f9da3931af..6fba8308077 100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -48,8 +48,7 @@ void WaypointMgr::Load()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!");
return;
}
@@ -87,7 +86,6 @@ void WaypointMgr::Load()
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
}
void WaypointMgr::ReloadPath(uint32 id)
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 3da9ac8fade..afc153a5000 100644
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -66,9 +66,11 @@ void AddSC_list_commandscript();
void AddSC_lookup_commandscript();
void AddSC_message_commandscript();
void AddSC_misc_commandscript();
+void AddSC_mmaps_commandscript();
void AddSC_modify_commandscript();
void AddSC_npc_commandscript();
void AddSC_quest_commandscript();
+void AddSC_rbac_commandscript();
void AddSC_reload_commandscript();
void AddSC_reset_commandscript();
void AddSC_server_commandscript();
@@ -76,7 +78,6 @@ void AddSC_tele_commandscript();
void AddSC_ticket_commandscript();
void AddSC_titles_commandscript();
void AddSC_wp_commandscript();
-void AddSC_mmaps_commandscript();
#ifdef SCRIPTS
//world
@@ -696,9 +697,11 @@ void AddCommandScripts()
AddSC_list_commandscript();
AddSC_message_commandscript();
AddSC_misc_commandscript();
+ AddSC_mmaps_commandscript();
AddSC_modify_commandscript();
AddSC_npc_commandscript();
AddSC_quest_commandscript();
+ AddSC_rbac_commandscript();
AddSC_reload_commandscript();
AddSC_reset_commandscript();
AddSC_server_commandscript();
@@ -706,7 +709,6 @@ void AddCommandScripts()
AddSC_ticket_commandscript();
AddSC_titles_commandscript();
AddSC_wp_commandscript();
- AddSC_mmaps_commandscript();
}
void AddWorldScripts()
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index cae8ea9d2d5..32fe5d2ef33 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -489,14 +489,14 @@ void ScriptMgr::OnGroupRateCalculation(float& rate, uint32 count, bool isRaid)
}
#define SCR_MAP_BGN(M, V, I, E, C, T) \
- if (V->GetEntry()->T()) \
+ if (V->GetEntry() && V->GetEntry()->T()) \
{ \
FOR_SCRIPTS(M, I, E) \
{ \
MapEntry const* C = I->second->GetEntry(); \
if (!C) \
continue; \
- if (entry->MapID == V->GetId()) \
+ if (C->MapID == V->GetId()) \
{
#define SCR_MAP_END \
@@ -580,6 +580,8 @@ void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player)
ASSERT(map);
ASSERT(player);
+ FOREACH_SCRIPT(PlayerScript)->OnMapChanged(player);
+
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnPlayerEnter(map, player);
SCR_MAP_END;
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 7f140cfffe0..b13c2da7f6c 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -754,6 +754,9 @@ class PlayerScript : public UnitScript
// Called when a player switches to a new zone
virtual void OnUpdateZone(Player* /*player*/, uint32 /*newZone*/, uint32 /*newArea*/) { }
+
+ // Called when a player changes to a new map (after moving to new map)
+ virtual void OnMapChanged(Player* /*player*/) { }
};
class GuildScript : public ScriptObject
diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp
index 649f4130c06..fe8b6804020 100644
--- a/src/server/game/Server/Protocol/PacketLog.cpp
+++ b/src/server/game/Server/Protocol/PacketLog.cpp
@@ -55,7 +55,7 @@ void PacketLog::LogPacket(WorldPacket const& packet, Direction direction)
data << uint8(direction);
for (uint32 i = 0; i < packet.size(); i++)
- data << const_cast<WorldPacket&>(packet)[i];
+ data << packet[i];
fwrite(data.contents(), 1, data.size(), _file);
fflush(_file);
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 6a26dafde79..1e36f342712 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -21,8 +21,10 @@
*/
#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it
+#include "Config.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "AccountMgr.h"
#include "Log.h"
#include "Opcodes.h"
#include "WorldPacket.h"
@@ -115,7 +117,8 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8
m_TutorialsChanged(false),
recruiterId(recruiter),
isRecruiter(isARecruiter),
- timeLastWhoCommand(0)
+ timeLastWhoCommand(0),
+ _RBACData(NULL)
{
if (sock)
{
@@ -143,8 +146,8 @@ WorldSession::~WorldSession()
m_Socket = NULL;
}
- if (_warden)
- delete _warden;
+ delete _warden;
+ delete _RBACData;
///- empty incoming packet queue
WorldPacket* packet = NULL;
@@ -406,14 +409,14 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
}
/// %Log the player out
-void WorldSession::LogoutPlayer(bool Save)
+void WorldSession::LogoutPlayer(bool save)
{
// finish pending transfers before starting the logout
while (_player && _player->IsBeingTeleportedFar())
HandleMoveWorldportAckOpcode();
m_playerLogout = true;
- m_playerSave = Save;
+ m_playerSave = save;
if (_player)
{
@@ -428,39 +431,6 @@ void WorldSession::LogoutPlayer(bool Save)
_player->BuildPlayerRepop();
_player->RepopAtGraveyard();
}
- else if (!_player->getAttackers().empty())
- {
- // build set of player who attack _player or who have pet attacking of _player
- std::set<Player*> aset;
- for (Unit::AttackerSet::const_iterator itr = _player->getAttackers().begin(); itr != _player->getAttackers().end(); ++itr)
- {
- Unit* owner = (*itr)->GetOwner(); // including player controlled case
- if (owner && owner->GetTypeId() == TYPEID_PLAYER)
- aset.insert(owner->ToPlayer());
- else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
- aset.insert((Player*)(*itr));
- }
-
- // CombatStop() method is removing all attackers from the AttackerSet
- // That is why it must be AFTER building current set of attackers
- _player->CombatStop();
- _player->getHostileRefManager().setOnlineOfflineState(false);
- _player->RemoveAllAurasOnDeath();
- _player->SetPvPDeath(!aset.empty());
- _player->KillPlayer();
- _player->BuildPlayerRepop();
- _player->RepopAtGraveyard();
-
- // give honor to all attackers from set like group case
- for (std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr)
- (*itr)->RewardHonor(_player, aset.size());
-
- // give bg rewards and update counters like kill by first from attackers
- // this can't be called for all attackers.
- if (!aset.empty())
- if (Battleground* bg = _player->GetBattleground())
- bg->HandleKillPlayer(_player, *aset.begin());
- }
else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
// this will kill character by SPELL_AURA_SPIRIT_OF_REDEMPTION
@@ -509,7 +479,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)
- if (Save)
+ if (save)
{
uint32 eslot;
for (int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j)
@@ -961,7 +931,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
ByteBuffer addonInfo;
addonInfo.resize(size);
- if (uncompress(const_cast<uint8*>(addonInfo.contents()), &uSize, const_cast<uint8*>(data.contents() + pos), data.size() - pos) == Z_OK)
+ if (uncompress(addonInfo.contents(), &uSize, data.contents() + pos, data.size() - pos) == Z_OK)
{
uint32 addonsCount;
addonInfo >> addonsCount; // addons count
@@ -1200,3 +1170,24 @@ void WorldSession::InitWarden(BigNumber* k, std::string const& os)
// _warden->Init(this, k);
}
}
+
+void WorldSession::LoadPermissions()
+{
+ uint32 id = GetAccountId();
+ std::string name;
+ int32 realmId = ConfigMgr::GetIntDefault("RealmID", 0);
+ AccountMgr::GetName(id, name);
+
+ _RBACData = new RBACData(id, name, realmId);
+ _RBACData->LoadFromDB();
+}
+
+RBACData* WorldSession::GetRBACData()
+{
+ return _RBACData;
+}
+
+bool WorldSession::HasPermission(uint32 permission)
+{
+ return _RBACData->HasPermission(permission);
+}
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index abe048279db..20fa7d9335d 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -39,6 +39,7 @@ class LoginQueryHolder;
class Object;
class Player;
class Quest;
+class RBACData;
class SpellCastTargets;
class Unit;
class Warden;
@@ -48,15 +49,18 @@ struct AreaTableEntry;
struct AuctionEntry;
struct DeclinedName;
struct ItemTemplate;
+struct MovementInfo;
+
+namespace lfg
+{
struct LfgJoinResultData;
-struct LfgLockStatus;
struct LfgPlayerBoot;
struct LfgProposal;
struct LfgQueueStatusData;
struct LfgPlayerRewardData;
struct LfgRoleCheck;
struct LfgUpdateData;
-struct MovementInfo;
+}
enum AccountDataType
{
@@ -213,6 +217,10 @@ class WorldSession
void SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos = 0);
void SendClientCacheVersion(uint32 version);
+ RBACData* GetRBACData();
+ bool HasPermission(uint32 permissionId);
+ void LoadPermissions();
+
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }
Player* GetPlayer() const { return _player; }
@@ -245,7 +253,7 @@ class WorldSession
return (_logoutTime > 0 && currTime >= _logoutTime + 20);
}
- void LogoutPlayer(bool Save);
+ void LogoutPlayer(bool save);
void KickPlayer();
void QueuePacket(WorldPacket* new_packet);
@@ -782,16 +790,16 @@ class WorldSession
void HandleLfrLeaveOpcode(WorldPacket& recvData);
void HandleLfgGetStatus(WorldPacket& recvData);
- void SendLfgUpdatePlayer(LfgUpdateData const& updateData);
- void SendLfgUpdateParty(LfgUpdateData const& updateData);
+ void SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData);
+ void SendLfgUpdateParty(lfg::LfgUpdateData const& updateData);
void SendLfgRoleChosen(uint64 guid, uint8 roles);
- void SendLfgRoleCheckUpdate(LfgRoleCheck const& pRoleCheck);
+ void SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& pRoleCheck);
void SendLfgLfrList(bool update);
- void SendLfgJoinResult(LfgJoinResultData const& joinData);
- void SendLfgQueueStatus(LfgQueueStatusData const& queueData);
- void SendLfgPlayerReward(LfgPlayerRewardData const& lfgPlayerRewardData);
- void SendLfgBootProposalUpdate(LfgPlayerBoot const& boot);
- void SendLfgUpdateProposal(LfgProposal const& proposal);
+ void SendLfgJoinResult(lfg::LfgJoinResultData const& joinData);
+ void SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData);
+ void SendLfgPlayerReward(lfg::LfgPlayerRewardData const& lfgPlayerRewardData);
+ void SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot);
+ void SendLfgUpdateProposal(lfg::LfgProposal const& proposal);
void SendLfgDisabled();
void SendLfgOfferContinue(uint32 dungeonEntry);
void SendLfgTeleportError(uint8 err);
@@ -911,14 +919,14 @@ class WorldSession
void LogUnprocessedTail(WorldPacket* packet);
// EnumData helpers
- bool CharCanLogin(uint32 lowGUID)
+ bool IsLegitCharacterForAccount(uint32 lowGUID)
{
- return _allowedCharsToLogin.find(lowGUID) != _allowedCharsToLogin.end();
+ return _legitCharacters.find(lowGUID) != _legitCharacters.end();
}
// this stores the GUIDs of the characters who can login
// characters who failed on Player::BuildEnumData shouldn't login
- std::set<uint32> _allowedCharsToLogin;
+ std::set<uint32> _legitCharacters;
uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set)
Player* _player;
@@ -951,6 +959,7 @@ class WorldSession
bool isRecruiter;
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
time_t timeLastWhoCommand;
+ RBACData* _RBACData;
};
#endif
/// @}
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index c80d25be139..128175d785b 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -372,9 +372,9 @@ int WorldSocket::handle_output_queue (GuardType& g)
const size_t send_len = mblk->length();
#ifdef MSG_NOSIGNAL
- ssize_t n = peer().send (mblk->rd_ptr(), send_len, MSG_NOSIGNAL);
+ ssize_t n = peer().send(mblk->rd_ptr(), send_len, MSG_NOSIGNAL);
#else
- ssize_t n = peer().send (mblk->rd_ptr(), send_len);
+ ssize_t n = peer().send(mblk->rd_ptr(), send_len);
#endif // MSG_NOSIGNAL
if (n == 0)
@@ -750,7 +750,6 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
uint32 clientBuild;
uint32 unk2, unk3, unk5, unk6, unk7;
uint64 unk4;
- BigNumber v, s, g, N;
WorldPacket packet, SendAddonPacked;
BigNumber k;
@@ -779,6 +778,8 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
clientSeed);
// Get the account information from the realmd database
+ // 0 1 2 3 4 5 6 7 8
+ // SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ?
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME);
stmt->setString(0, account);
@@ -795,27 +796,11 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
Field* fields = result->Fetch();
- uint8 expansion = fields[6].GetUInt8();
+ uint8 expansion = fields[4].GetUInt8();
uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
if (expansion > world_expansion)
expansion = world_expansion;
- N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
- g.SetDword (7);
-
- v.SetHexStr(fields[4].GetCString());
- s.SetHexStr (fields[5].GetCString());
-
- const char* sStr = s.AsHexStr(); // Must be freed by OPENSSL_free()
- const char* vStr = v.AsHexStr(); // Must be freed by OPENSSL_free()
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s",
- sStr,
- vStr);
-
- OPENSSL_free((void*)sStr);
- OPENSSL_free((void*)vStr);
-
///- Re-check ip locking (same check as in realmd).
if (fields[3].GetUInt8() == 1) // if ip is locked
{
@@ -831,13 +816,13 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
k.SetHexStr(fields[1].GetCString());
- int64 mutetime = fields[7].GetInt64();
+ int64 mutetime = fields[5].GetInt64();
//! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
if (mutetime < 0)
{
mutetime = time(NULL) + llabs(mutetime);
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN);
stmt->setInt64(0, mutetime);
stmt->setUInt32(1, id);
@@ -845,12 +830,12 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
LoginDatabase.Execute(stmt);
}
- locale = LocaleConstant (fields[8].GetUInt8());
+ locale = LocaleConstant (fields[6].GetUInt8());
if (locale >= TOTAL_LOCALES)
locale = LOCALE_enUS;
- uint32 recruiter = fields[9].GetUInt32();
- std::string os = fields[10].GetString();
+ uint32 recruiter = fields[7].GetUInt32();
+ std::string os = fields[8].GetString();
// Must be done before WorldSession is created
if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED) && os != "Win" && os != "OSX")
@@ -953,6 +938,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
m_Session->LoadGlobalAccountData();
m_Session->LoadTutorialsData();
m_Session->ReadAddonsInfo(recvPacket);
+ m_Session->LoadPermissions();
// Initialize Warden system only if it is enabled by config
if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
@@ -994,7 +980,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
- if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity()))
+ if (m_Session && !m_Session->HasPermission(RBAC_PERM_SKIP_CHECK_OVERSPEED_PING))
{
sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
m_Session->GetPlayerInfo().c_str(), GetRemoteAddress().c_str());
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index 8b5ae4863d0..e6ba28d5f1c 100644
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -55,8 +55,7 @@ void LoadSkillDiscoveryTable()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
return;
}
@@ -154,7 +153,6 @@ void LoadSkillDiscoveryTable()
}
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
}
uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player)
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 090e2e8205a..5c3b69e48d2 100644
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -60,8 +60,7 @@ void LoadSkillExtraItemTable()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
return;
}
@@ -75,28 +74,28 @@ void LoadSkillExtraItemTable()
if (!sSpellMgr->GetSpellInfo(spellId))
{
- sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
if (!sSpellMgr->GetSpellInfo(requiredSpecialization))
{
- sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
+ sLog->outError(LOG_FILTER_SQL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
}
float additionalCreateChance = fields[2].GetFloat();
if (additionalCreateChance <= 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
continue;
}
uint8 additionalMaxNum = fields[3].GetUInt8();
if (!additionalMaxNum)
{
- sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
}
@@ -111,7 +110,6 @@ void LoadSkillExtraItemTable()
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
}
bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance, uint8 &additionalMax)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 9230c46db15..a51d591f54c 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -488,7 +488,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
break;
}
- GetBase()->CallScriptEffectCalcAmountHandlers(const_cast<AuraEffect const*>(this), amount, m_canBeRecalculated);
+ GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated);
amount *= GetBase()->GetStackAmount();
return amount;
}
@@ -522,7 +522,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
break;
}
- GetBase()->CallScriptEffectCalcPeriodicHandlers(const_cast<AuraEffect const*>(this), m_isPeriodic, m_amplitude);
+ GetBase()->CallScriptEffectCalcPeriodicHandlers(this, m_isPeriodic, m_amplitude);
if (!m_isPeriodic)
return;
@@ -598,7 +598,7 @@ void AuraEffect::CalculateSpellMod()
default:
break;
}
- GetBase()->CallScriptEffectCalcSpellModHandlers(const_cast<AuraEffect const*>(this), m_spellmod);
+ GetBase()->CallScriptEffectCalcSpellModHandlers(this, m_spellmod);
}
void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply)
@@ -657,15 +657,15 @@ void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply)
// call scripts helping/replacing effect handlers
bool prevented = false;
if (apply)
- prevented = GetBase()->CallScriptEffectApplyHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode);
+ prevented = GetBase()->CallScriptEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);
else
- prevented = GetBase()->CallScriptEffectRemoveHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode);
+ prevented = GetBase()->CallScriptEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);
// check if script events have removed the aura or if default effect prevention was requested
if ((apply && aurApp->GetRemoveMode()) || prevented)
return;
- (*this.*AuraEffectHandler [GetAuraType()])(const_cast<AuraApplication const*>(aurApp), mode, apply);
+ (*this.*AuraEffectHandler[GetAuraType()])(aurApp, mode, apply);
// check if script events have removed the aura or if default effect prevention was requested
if (apply && aurApp->GetRemoveMode())
@@ -673,9 +673,9 @@ void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply)
// call scripts triggering additional events after apply/remove
if (apply)
- GetBase()->CallScriptAfterEffectApplyHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode);
+ GetBase()->CallScriptAfterEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);
else
- GetBase()->CallScriptAfterEffectRemoveHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), (AuraEffectHandleModes)mode);
+ GetBase()->CallScriptAfterEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);
}
void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply)
@@ -980,7 +980,7 @@ void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const
void AuraEffect::HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)
{
- bool prevented = GetBase()->CallScriptEffectProcHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), eventInfo);
+ bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
if (prevented)
return;
@@ -1005,7 +1005,7 @@ void AuraEffect::HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo)
break;
}
- GetBase()->CallScriptAfterEffectProcHandlers(const_cast<AuraEffect const*>(this), const_cast<AuraApplication const*>(aurApp), eventInfo);
+ GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
}
void AuraEffect::CleanupTriggeredSpells(Unit* target)
@@ -2375,7 +2375,10 @@ void AuraEffect::HandleAuraTrackCreatures(AuraApplication const* aurApp, uint8 m
if (target->GetTypeId() != TYPEID_PLAYER)
return;
- target->SetUInt32Value(PLAYER_TRACK_CREATURES, (apply) ? ((uint32)1)<<(GetMiscValue()-1) : 0);
+ if (apply)
+ target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
+ else
+ target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
}
void AuraEffect::HandleAuraTrackResources(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -2388,7 +2391,10 @@ void AuraEffect::HandleAuraTrackResources(AuraApplication const* aurApp, uint8 m
if (target->GetTypeId() != TYPEID_PLAYER)
return;
- target->SetUInt32Value(PLAYER_TRACK_RESOURCES, (apply) ? ((uint32)1)<<(GetMiscValue()-1): 0);
+ if (apply)
+ target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
+ else
+ target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
}
void AuraEffect::HandleAuraTrackStealthed(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -3339,22 +3345,19 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint
Unit* target = aurApp->GetTarget();
- target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
// when removing flag aura, handle flag drop
- if (!apply && target->GetTypeId() == TYPEID_PLAYER
- && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
+ Player* player = target->ToPlayer();
+ if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
{
- if (target->GetTypeId() == TYPEID_PLAYER)
+ if (player->InBattleground())
{
- if (target->ToPlayer()->InBattleground())
- {
- if (Battleground* bg = target->ToPlayer()->GetBattleground())
- bg->EventPlayerDroppedFlag(target->ToPlayer());
- }
- else
- sOutdoorPvPMgr->HandleDropFlag((Player*)target, GetSpellInfo()->Id);
+ if (Battleground* bg = player->GetBattleground())
+ bg->EventPlayerDroppedFlag(player);
}
+ else
+ sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
}
}
@@ -5058,10 +5061,6 @@ void AuraEffect::HandleAuraEmpathy(AuraApplication const* aurApp, uint8 mode, bo
return;
Unit* target = aurApp->GetTarget();
-
- if (target->GetTypeId() != TYPEID_UNIT)
- return;
-
if (!apply)
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
@@ -5069,8 +5068,7 @@ void AuraEffect::HandleAuraEmpathy(AuraApplication const* aurApp, uint8 mode, bo
return;
}
- CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(target->GetEntry());
- if (ci && ci->type == CREATURE_TYPE_BEAST)
+ if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
}
@@ -5298,10 +5296,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,
target->SendMessageToSet(&data, true);
if (apply)
- {
- data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- target->ToPlayer()->GetSession()->SendPacket(&data);
- }
+ target->ToPlayer()->SendOnCancelExpectedVehicleRideAura();
}
void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 795908ce4b5..375f9ef067c 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -908,6 +908,10 @@ bool Aura::CanBeSaved() const
if (HasEffectType(SPELL_AURA_OPEN_STABLE))
return false;
+ // Can't save vehicle auras, it requires both caster & target to be in world
+ if (HasEffectType(SPELL_AURA_CONTROL_VEHICLE))
+ return false;
+
// Incanter's Absorbtion - considering the minimal duration and problems with aura stacking
// we skip saving this aura
// Also for some reason other auras put as MultiSlot crash core on keeping them after restart,
@@ -2048,14 +2052,14 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event
void Aura::TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo)
{
- CallScriptProcHandlers(const_cast<AuraApplication const*>(aurApp), eventInfo);
+ CallScriptProcHandlers(aurApp, eventInfo);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (aurApp->HasEffect(i))
// OnEffectProc / AfterEffectProc hooks handled in AuraEffect::HandleProc()
GetEffect(i)->HandleProc(aurApp, eventInfo);
- CallScriptAfterProcHandlers(const_cast<AuraApplication const*>(aurApp), eventInfo);
+ CallScriptAfterProcHandlers(aurApp, eventInfo);
// Remove aura if we've used last charge to proc
if (IsUsingCharges() && !GetCharges())
@@ -2092,16 +2096,17 @@ void Aura::LoadScripts()
bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)
{
+ bool result = true;
for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- if (!(*hookItr).Call(*scritr, target))
- return false;
+ result &= hookItr->Call(*scritr, target);
+
(*scritr)->_FinishScriptCall();
}
- return true;
+ return result;
}
void Aura::CallScriptDispel(DispelInfo* dispelInfo)
@@ -2111,7 +2116,8 @@ void Aura::CallScriptDispel(DispelInfo* dispelInfo)
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, dispelInfo);
+ hookItr->Call(*scritr, dispelInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2123,7 +2129,8 @@ void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, dispelInfo);
+ hookItr->Call(*scritr, dispelInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2136,14 +2143,15 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
+
return preventDefault;
}
@@ -2155,12 +2163,12 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
return preventDefault;
@@ -2173,10 +2181,9 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2188,10 +2195,9 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2204,14 +2210,15 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
+
return preventDefault;
}
@@ -2222,10 +2229,9 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff)
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2237,10 +2243,9 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 &
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, amount, canBeRecalculated);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, amount, canBeRecalculated);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2252,10 +2257,9 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool &
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, isPeriodic, amplitude);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, isPeriodic, amplitude);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2267,10 +2271,9 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, spellMod);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, spellMod);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2282,11 +2285,13 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication co
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
- defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
+
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
+ if (!defaultPrevented)
+ defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2298,10 +2303,9 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplicati
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2313,10 +2317,9 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplicatio
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2328,10 +2331,9 @@ void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraAppli
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2343,26 +2345,27 @@ void Aura::CallScriptEffectSplitHandlers(AuraEffect* aurEff, AuraApplication con
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_SPLIT, aurApp);
std::list<AuraScript::EffectSplitHandler>::iterator effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, splitAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, splitAmount);
+
(*scritr)->_FinishScriptCall();
}
}
bool Aura::CallScriptCheckProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)
{
+ bool result = true;
for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_PROC, aurApp);
std::list<AuraScript::CheckProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- if (!(*hookItr).Call(*scritr, eventInfo))
- return false;
+ result &= hookItr->Call(*scritr, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
- return true;
+
+ return result;
}
bool Aura::CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)
@@ -2373,12 +2376,14 @@ bool Aura::CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEven
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PREPARE_PROC, aurApp);
std::list<AuraScript::AuraProcHandler>::iterator effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();
for (; effItr != effEndItr; ++effItr)
- (*effItr).Call(*scritr, eventInfo);
+ effItr->Call(*scritr, eventInfo);
+
+ if (prepare)
+ prepare = !(*scritr)->_IsDefaultActionPrevented();
- if (prepare && (*scritr)->_IsDefaultActionPrevented())
- prepare = false;
(*scritr)->_FinishScriptCall();
}
+
return prepare;
}
@@ -2389,7 +2394,8 @@ void Aura::CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo&
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp);
std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, eventInfo);
+ hookItr->Call(*scritr, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2401,7 +2407,8 @@ void Aura::CallScriptAfterProcHandlers(AuraApplication const* aurApp, ProcEventI
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_PROC, aurApp);
std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, eventInfo);
+ hookItr->Call(*scritr, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2414,12 +2421,12 @@ bool Aura::CallScriptEffectProcHandlers(AuraEffect const* aurEff, AuraApplicatio
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PROC, aurApp);
std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, eventInfo);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, eventInfo);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
return preventDefault;
@@ -2432,10 +2439,9 @@ void Aura::CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraAppli
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, aurApp);
std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, eventInfo);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 4d75aec2cae..ae1389c5f11 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5148,26 +5148,23 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->HasUnitState(UNIT_STATE_ROOT))
return SPELL_FAILED_ROOTED;
- Unit* target = m_targets.GetUnitTarget();
-
- if (!target)
- return SPELL_FAILED_DONT_REPORT;
-
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- if (!target->isAlive())
- return SPELL_FAILED_BAD_TARGETS;
-
- Position pos;
- target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
- target->GetFirstCollisionPosition(pos, CONTACT_DISTANCE, target->GetRelativeAngle(m_caster));
+ if (GetSpellInfo()->NeedsExplicitUnitTarget())
+ {
+ Unit* target = m_targets.GetUnitTarget();
+ if (!target)
+ return SPELL_FAILED_DONT_REPORT;
- m_preGeneratedPath.SetPathLengthLimit(m_spellInfo->GetMaxRange(true) * 1.5f);
- bool result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize());
- if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
- return SPELL_FAILED_OUT_OF_RANGE;
- else if (!result)
- return SPELL_FAILED_NOPATH;
+ Position pos;
+ target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
+ target->GetFirstCollisionPosition(pos, CONTACT_DISTANCE, target->GetRelativeAngle(m_caster));
+ m_preGeneratedPath.SetPathLengthLimit(m_spellInfo->GetMaxRange(true) * 1.5f);
+ bool result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize());
+ if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
+ return SPELL_FAILED_OUT_OF_RANGE;
+ else if (!result || m_preGeneratedPath.GetPathType() & PATHFIND_NOPATH)
+ return SPELL_FAILED_NOPATH;
+ }
break;
}
case SPELL_EFFECT_SKINNING:
@@ -5945,8 +5942,9 @@ SpellCastResult Spell::CheckItems()
// if not item target then required item must be equipped
else
{
- if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo))
- return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
+ 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;
}
// check spell focus object
@@ -6328,7 +6326,7 @@ SpellCastResult Spell::CheckItems()
}
// check weapon presence in slots for main/offhand weapons
- if (m_spellInfo->EquippedItemClass >=0)
+ if (!(_triggeredCastFlags & TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT) && m_spellInfo->EquippedItemClass >=0)
{
// main hand weapon required
if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_MAIN_HAND)
@@ -6519,7 +6517,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
break;
}
- if (IsTriggered() || m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS)
+ if (IsTriggered() || m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS || DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_DISABLE_LOS))
return true;
// todo: shit below shouldn't be here, but it's temporary
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index ba7c87ba10a..9d3ec6630e5 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2763,7 +2763,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
if (!item_owner)
return;
- if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (item_owner != p_caster && p_caster->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
@@ -2828,7 +2828,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
if (!item_owner)
return;
- if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (item_owner != p_caster && p_caster->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
@@ -2962,7 +2962,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
if (!item_owner)
return;
- if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
+ if (item_owner != p_caster && p_caster->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
@@ -3212,24 +3212,6 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
switch (m_spellInfo->SpellFamilyName)
{
- case SPELLFAMILY_GENERIC:
- {
- switch (m_spellInfo->Id)
- {
- case 69055: // Saber Lash
- case 70814: // Saber Lash
- {
- uint32 count = 0;
- for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
- if (ihit->effectMask & (1 << effIndex))
- ++count;
-
- totalDamagePercentMod /= count;
- break;
- }
- }
- break;
- }
case SPELLFAMILY_WARRIOR:
{
// Devastate (player ones)
@@ -3920,7 +3902,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->CastSpell(unitTarget, iTmpSpellId, true);
Creature* npc = unitTarget->ToCreature();
- npc->LoadEquipment(npc->GetEquipmentId());
+ npc->LoadEquipment();
return;
}
// Emblazon Runeblade
@@ -4936,7 +4918,8 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
{
- if (m_preGeneratedPath.GetPathType() & PATHFIND_NOPATH)
+ // Spell is not using explicit target - no generated path
+ if (m_preGeneratedPath.GetPathType() == PATHFIND_BLANK)
{
Position pos;
unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 0c298efd83e..9a9369bad28 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -849,7 +849,7 @@ bool SpellInfo::IsLootCrafting() const
return (Effects[0].Effect == SPELL_EFFECT_CREATE_RANDOM_ITEM ||
// different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item
(Effects[0].Effect == SPELL_EFFECT_CREATE_ITEM_2 &&
- (TotemCategory[0] != 0 || Effects[0].ItemType == 0)));
+ ((TotemCategory[0] != 0 || (Totem[0] != 0 && SpellIconID == 1)) || Effects[0].ItemType == 0)));
}
bool SpellInfo::IsQuestTame() const
@@ -1030,6 +1030,12 @@ bool SpellInfo::IsMultiSlotAura() const
return IsPassive() || Id == 55849 || Id == 40075 || Id == 44413; // Power Spark, Fel Flak Fire, Incanter's Absorption
}
+bool SpellInfo::IsStackableOnOneSlotWithDifferentCasters() const
+{
+ /// TODO: Re-verify meaning of SPELL_ATTR3_STACK_FOR_DIFF_CASTERS and update conditions here
+ return StackAmount > 1 && !IsChanneled() && !(AttributesEx3 & SPELL_ATTR3_STACK_FOR_DIFF_CASTERS);
+}
+
bool SpellInfo::IsDeathPersistent() const
{
return AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT;
@@ -1922,6 +1928,9 @@ SpellSpecificType SpellInfo::GetSpellSpecific() const
case SPELL_AURA_AOE_CHARM:
return SPELL_SPECIFIC_CHARM;
case SPELL_AURA_TRACK_CREATURES:
+ /// @workaround For non-stacking tracking spells (We need generic solution)
+ if (Id == 30645) // Gas Cloud Tracking
+ return SPELL_SPECIFIC_NORMAL;
case SPELL_AURA_TRACK_RESOURCES:
case SPELL_AURA_TRACK_STEALTHED:
return SPELL_SPECIFIC_TRACKER;
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 23682c3d48f..bbc5b61e282 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -392,6 +392,7 @@ public:
bool IsStackableWithRanks() const;
bool IsPassiveStackableWithRanks() const;
bool IsMultiSlotAura() const;
+ bool IsStackableOnOneSlotWithDifferentCasters() const;
bool IsDeathPersistent() const;
bool IsRequiringDeadTarget() const;
bool IsAllowingDeadTarget() const;
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index b258f01ccd5..312189ffad8 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -3371,6 +3371,17 @@ void SpellMgr::LoadDbcDataCorrections()
case 64596: // Cosmic Smash (Algalon the Observer)
spellInfo->rangeIndex = 6; // 100yd
break;
+ case 64014: // Expedition Base Camp Teleport
+ case 64024: // Conservatory Teleport
+ case 64025: // Halls of Invention Teleport
+ case 64028: // Colossal Forge Teleport
+ case 64029: // Shattered Walkway Teleport
+ case 64030: // Antechamber Teleport
+ case 64031: // Scrapyard Teleport
+ case 64032: // Formation Grounds Teleport
+ case 65042: // Prison of Yogg-Saron Teleport
+ spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DB;
+ break;
// ENDOF ULDUAR SPELLS
//
// TRIAL OF THE CRUSADER SPELLS
@@ -3397,9 +3408,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 70861: // Sindragosa's Lair Teleport
spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DB;
break;
- case 69055: // Saber Lash (Lord Marrowgar)
- case 70814: // Saber Lash (Lord Marrowgar)
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_5_YARDS; // 5yd
+ case 69055: // Bone Slice (Lord Marrowgar)
+ case 70814: // Bone Slice (Lord Marrowgar)
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_8_YARDS; // 5yd
break;
case 69075: // Bone Storm (Lord Marrowgar)
case 70834: // Bone Storm (Lord Marrowgar)
@@ -3464,7 +3475,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 71518: // Unholy Infusion Quest Credit (Professor Putricide)
case 72934: // Blood Infusion Quest Credit (Blood-Queen Lana'thel)
case 72289: // Frost Infusion Quest Credit (Sindragosa)
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // another missing radius
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // another missing radius
break;
case 71708: // Empowered Flare (Blood Prince Council)
case 72785: // Empowered Flare (Blood Prince Council)
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 89ed223545f..6229a30a5f0 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -612,7 +612,7 @@ SpellValue const* SpellScript::GetSpellValue()
bool AuraScript::_Validate(SpellInfo const* entry)
{
for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
- if (!entry->HasAreaAuraEffect())
+ if (!entry->HasAreaAuraEffect() && !entry->HasEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
sLog->outError(LOG_FILTER_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<AuraDispelHandler>::iterator itr = OnDispel.begin(); itr != OnDispel.end(); ++itr)
diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp
index a99688c8844..af695c482cf 100644
--- a/src/server/game/Warden/Warden.cpp
+++ b/src/server/game/Warden/Warden.cpp
@@ -219,7 +219,7 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)
{
- _warden->DecryptData(const_cast<uint8*>(recvData.contents()), recvData.size());
+ _warden->DecryptData(recvData.contents(), recvData.size());
uint8 opcode;
recvData >> opcode;
sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size()));
diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp
index b96cb1156c2..ec271192450 100644
--- a/src/server/game/Warden/WardenCheckMgr.cpp
+++ b/src/server/game/Warden/WardenCheckMgr.cpp
@@ -44,7 +44,6 @@ void WardenCheckMgr::LoadWardenChecks()
if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
{
sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped.");
-
return;
}
@@ -52,8 +51,7 @@ void WardenCheckMgr::LoadWardenChecks()
if (!result)
{
- sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!");
return;
}
@@ -145,8 +143,7 @@ void WardenCheckMgr::LoadWardenChecks()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden checks.", count);
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u warden checks.", count);
}
void WardenCheckMgr::LoadWardenOverrides()
@@ -155,7 +152,6 @@ void WardenCheckMgr::LoadWardenOverrides()
if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
{
sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped.");
-
return;
}
@@ -164,8 +160,7 @@ void WardenCheckMgr::LoadWardenOverrides()
if (!result)
{
- sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!");
return;
}
@@ -194,8 +189,7 @@ void WardenCheckMgr::LoadWardenOverrides()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden action overrides.", count);
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u warden action overrides.", count);
}
WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id)
diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp
index 7c2979e0dc6..fa84cd216b6 100644
--- a/src/server/game/Warden/WardenMac.cpp
+++ b/src/server/game/Warden/WardenMac.cpp
@@ -206,7 +206,7 @@ void WardenMac::RequestData()
buff.hexlike();
// Encrypt with warden RC4 key.
- EncryptData(const_cast<uint8*>(buff.contents()), buff.size());
+ EncryptData(buff.contents(), buff.size());
WorldPacket pkt(SMSG_WARDEN_DATA, buff.size());
pkt.append(buff);
diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp
index 4da05eded0c..bf423459222 100644
--- a/src/server/game/Warden/WardenWin.cpp
+++ b/src/server/game/Warden/WardenWin.cpp
@@ -310,7 +310,7 @@ void WardenWin::RequestData()
buff.hexlike();
// Encrypt with warden RC4 key
- EncryptData(const_cast<uint8*>(buff.contents()), buff.size());
+ EncryptData(buff.contents(), buff.size());
WorldPacket pkt(SMSG_WARDEN_DATA, buff.size());
pkt.append(buff);
diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp
index cd148712b55..64ee188a0d2 100644
--- a/src/server/game/Weather/Weather.cpp
+++ b/src/server/game/Weather/Weather.cpp
@@ -221,6 +221,9 @@ bool Weather::UpdateWeather()
char const* wthstr;
switch (state)
{
+ case WEATHER_STATE_FOG:
+ wthstr = "fog";
+ break;
case WEATHER_STATE_LIGHT_RAIN:
wthstr = "light rain";
break;
diff --git a/src/server/game/Weather/Weather.h b/src/server/game/Weather/Weather.h
index 1fcd822d580..2645d3f2067 100644
--- a/src/server/game/Weather/Weather.h
+++ b/src/server/game/Weather/Weather.h
@@ -46,6 +46,7 @@ struct WeatherData
enum WeatherState
{
WEATHER_STATE_FINE = 0,
+ WEATHER_STATE_FOG = 1,
WEATHER_STATE_LIGHT_RAIN = 3,
WEATHER_STATE_MEDIUM_RAIN = 4,
WEATHER_STATE_HEAVY_RAIN = 5,
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index 802cdb8209f..769e40b4dff 100644
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -96,8 +96,7 @@ void LoadWeatherData()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 weather definitions. DB table `game_weather` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 weather definitions. DB table `game_weather` is empty.");
return;
}
@@ -141,7 +140,6 @@ void LoadWeatherData()
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
}
void SendFineWeatherUpdateToPlayer(Player* player)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 26a7986bcb8..955f3b7b99f 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -267,7 +267,7 @@ void World::AddSession_(WorldSession* s)
if (decrease_session)
--Sessions;
- if (pLimit > 0 && Sessions >= pLimit && AccountMgr::IsPlayerAccount(s->GetSecurity()) && !HasRecentlyDisconnected(s))
+ if (pLimit > 0 && Sessions >= pLimit && !s->HasPermission(RBAC_PERM_SKIP_QUEUE) && !HasRecentlyDisconnected(s))
{
AddQueuedPlayer(s);
UpdateMaxSessionCounters();
@@ -585,7 +585,6 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_TICKET_LEVEL_REQ] = ConfigMgr::GetIntDefault("LevelReq.Ticket", 1);
m_int_configs[CONFIG_AUCTION_LEVEL_REQ] = ConfigMgr::GetIntDefault("LevelReq.Auction", 1);
m_int_configs[CONFIG_MAIL_LEVEL_REQ] = ConfigMgr::GetIntDefault("LevelReq.Mail", 1);
- m_bool_configs[CONFIG_ALLOW_PLAYER_COMMANDS] = ConfigMgr::GetBoolDefault("AllowPlayerCommands", 1);
m_bool_configs[CONFIG_PRESERVE_CUSTOM_CHANNELS] = ConfigMgr::GetBoolDefault("PreserveCustomChannels", false);
m_int_configs[CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION] = ConfigMgr::GetIntDefault("PreserveCustomChannelDuration", 14);
m_bool_configs[CONFIG_GRID_UNLOAD] = ConfigMgr::GetBoolDefault("GridUnload", true);
@@ -956,7 +955,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHATFLOOD_MESSAGE_DELAY] = ConfigMgr::GetIntDefault("ChatFlood.MessageDelay", 1);
m_int_configs[CONFIG_CHATFLOOD_MUTE_TIME] = ConfigMgr::GetIntDefault("ChatFlood.MuteTime", 10);
- m_int_configs[CONFIG_EVENT_ANNOUNCE] = ConfigMgr::GetIntDefault("Event.Announce", 0);
+ m_bool_configs[CONFIG_EVENT_ANNOUNCE] = ConfigMgr::GetIntDefault("Event.Announce", false);
m_float_configs[CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS] = ConfigMgr::GetFloatDefault("CreatureFamilyFleeAssistanceRadius", 30.0f);
m_float_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS] = ConfigMgr::GetFloatDefault("CreatureFamilyAssistanceRadius", 10.0f);
@@ -1059,8 +1058,6 @@ void World::LoadConfigSettings(bool reload)
sLog->outError(LOG_FILTER_SERVER_LOADING, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
}
- m_int_configs[CONFIG_INSTANT_LOGOUT] = ConfigMgr::GetIntDefault("InstantLogout", SEC_MODERATOR);
-
m_int_configs[CONFIG_GUILD_EVENT_LOG_COUNT] = ConfigMgr::GetIntDefault("Guild.EventLogRecordsCount", GUILD_EVENTLOG_MAX_RECORDS);
if (m_int_configs[CONFIG_GUILD_EVENT_LOG_COUNT] > GUILD_EVENTLOG_MAX_RECORDS)
m_int_configs[CONFIG_GUILD_EVENT_LOG_COUNT] = GUILD_EVENTLOG_MAX_RECORDS;
@@ -1224,8 +1221,9 @@ void World::LoadConfigSettings(bool reload)
// misc
m_bool_configs[CONFIG_PDUMP_NO_PATHS] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowPaths", true);
m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true);
+ m_bool_configs[CONFIG_UI_QUESTLEVELS_IN_DIALOGS] = ConfigMgr::GetBoolDefault("UI.ShowQuestLevelsInDialogs", false);
- // call ScriptMgr if we're reloading the configuration
+ // Wintergrasp battlefield
m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = ConfigMgr::GetBoolDefault("Wintergrasp.Enable", false);
m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMax", 100);
m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMin", 0);
@@ -1234,6 +1232,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150);
m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
+ // call ScriptMgr if we're reloading the configuration
if (reload)
sScriptMgr->OnConfigLoad(reload);
}
@@ -1347,6 +1346,8 @@ void World::SetInitialWorldSettings()
sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Account Roles and Permissions...");
+ sAccountMgr->LoadRBAC();
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Page Texts...");
sObjectMgr->LoadPageTexts();
@@ -1405,12 +1406,12 @@ void World::SetInitialWorldSettings()
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data...");
sObjectMgr->LoadCreatureModelInfo();
- sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates...");
- sObjectMgr->LoadEquipmentTemplates();
-
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates...");
sObjectMgr->LoadCreatureTemplates();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates..."); // must be after LoadCreatureTemplates
+ sObjectMgr->LoadEquipmentTemplates();
+
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons...");
sObjectMgr->LoadCreatureTemplateAddons();
@@ -1432,6 +1433,9 @@ void World::SetInitialWorldSettings()
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Data...");
sObjectMgr->LoadCreatures();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Temporary Summon Data...");
+ sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates()
+
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells...");
sSpellMgr->LoadPetLevelupSpellMap();
@@ -2114,18 +2118,21 @@ void World::SendGlobalMessage(WorldPacket* packet, WorldSession* self, uint32 te
/// Send a packet to all GMs (except self if mentioned)
void World::SendGlobalGMMessage(WorldPacket* packet, WorldSession* self, uint32 team)
{
- SessionMap::iterator itr;
- for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+ for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
{
- if (itr->second &&
- itr->second->GetPlayer() &&
- itr->second->GetPlayer()->IsInWorld() &&
- itr->second != self &&
- !AccountMgr::IsPlayerAccount(itr->second->GetSecurity()) &&
- (team == 0 || itr->second->GetPlayer()->GetTeam() == team))
- {
- itr->second->SendPacket(packet);
- }
+ // check if session and can receive global GM Messages and its not self
+ WorldSession* session = itr->second;
+ if (!session || session == self || !session->HasPermission(RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE))
+ continue;
+
+ // Player should be in world
+ Player* player = session->GetPlayer();
+ if (!player || !player->IsInWorld())
+ continue;
+
+ // Send only to same team, if team is given
+ if (!team || player->GetTeam() == team)
+ session->SendPacket(packet);
}
}
@@ -2213,15 +2220,19 @@ void World::SendGMText(int32 string_id, ...)
Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
Trinity::LocalizedPacketListDo<Trinity::WorldWorldTextBuilder> wt_do(wt_builder);
- for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+ for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
{
- if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
+ // Session should have permissions to receive global gm messages
+ WorldSession* session = itr->second;
+ if (!session || !session->HasPermission(RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE))
continue;
- if (AccountMgr::IsPlayerAccount(itr->second->GetSecurity()))
+ // Player should be in world
+ Player* player = session->GetPlayer();
+ if (!player || !player->IsInWorld())
continue;
- wt_do(itr->second->GetPlayer());
+ wt_do(player);
}
va_end(ap);
@@ -2857,8 +2868,6 @@ void World::ResetMonthlyQuests()
if (itr->second->GetPlayer())
itr->second->GetPlayer()->ResetMonthlyQuestStatus();
- time_t mostRecentQuestTime = 0;
-
// generate time
time_t curTime = time(NULL);
tm localTm = *localtime(&curTime);
@@ -2885,14 +2894,8 @@ void World::ResetMonthlyQuests()
time_t nextMonthResetTime = mktime(&localTm);
- // last reset time before current moment
- time_t resetTime = (curTime < nextMonthResetTime) ? nextMonthResetTime - MONTH : nextMonthResetTime;
-
- // need reset (if we have quest time before last reset time (not processed by some reason)
- if (mostRecentQuestTime && mostRecentQuestTime <= resetTime)
- m_NextMonthlyQuestReset = mostRecentQuestTime;
- else // plan next reset time
- m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
+ // plan next reset time
+ m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
sWorld->setWorldState(WS_MONTHLY_QUEST_RESET_TIME, uint64(m_NextMonthlyQuestReset));
}
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 4a7629cb3af..612078f17bf 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -165,6 +165,8 @@ enum WorldBoolConfigs
CONFIG_WARDEN_ENABLED,
CONFIG_ENABLE_MMAPS,
CONFIG_WINTERGRASP_ENABLE,
+ CONFIG_UI_QUESTLEVELS_IN_DIALOGS, // Should we add quest levels to the title in the NPC dialogs?
+ CONFIG_EVENT_ANNOUNCE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -252,7 +254,6 @@ enum WorldIntConfigs
CONFIG_CHATFLOOD_MESSAGE_COUNT,
CONFIG_CHATFLOOD_MESSAGE_DELAY,
CONFIG_CHATFLOOD_MUTE_TIME,
- CONFIG_EVENT_ANNOUNCE,
CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY,
CONFIG_CREATURE_FAMILY_FLEE_DELAY,
CONFIG_WORLD_BOSS_LEVEL_DIFF,
@@ -732,7 +733,8 @@ class World
void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level);
void UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE);
void UpdateCharacterNameDataLevel(uint32 guid, uint8 level);
- void DeleteCharaceterNameData(uint32 guid) { _characterNameDataMap.erase(guid); }
+ void DeleteCharacterNameData(uint32 guid) { _characterNameDataMap.erase(guid); }
+ bool HasCharacterNameData(uint32 guid) { return _characterNameDataMap.find(guid) != _characterNameDataMap.end(); }
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
void SetCleaningFlags(uint32 flags) { m_CleaningFlags = flags; }
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt
index 7b9e2444952..83e97b2c80d 100644
--- a/src/server/scripts/Commands/CMakeLists.txt
+++ b/src/server/scripts/Commands/CMakeLists.txt
@@ -35,6 +35,7 @@ set(scripts_STAT_SRCS
Commands/cs_modify.cpp
Commands/cs_npc.cpp
Commands/cs_quest.cpp
+ Commands/cs_rbac.cpp
Commands/cs_reload.cpp
Commands/cs_reset.cpp
Commands/cs_tele.cpp
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 3a20a03bb4a..4dc44bbfc58 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -106,7 +106,7 @@ public:
if (!accountName || !password)
return false;
- AccountOpResult result = AccountMgr::CreateAccount(std::string(accountName), std::string(password));
+ AccountOpResult result = sAccountMgr->CreateAccount(std::string(accountName), std::string(password));
switch (result)
{
case AOR_OK:
@@ -503,36 +503,8 @@ public:
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);
- }
-
+ RBACData* rbac = isAccountNameGiven ? NULL : handler->getSelectedPlayer()->GetSession()->GetRBACData();
+ sAccountMgr->UpdateAccountAccess(rbac, targetAccountId, uint8(gm), gmRealmID);
handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
return true;
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index 932bb562f11..168a5ec60b8 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -59,30 +59,32 @@ public:
// Enables or disables hiding of the staff badge
static bool HandleGMChatCommand(ChatHandler* handler, char const* args)
{
- if (!*args)
+ if (WorldSession* session = handler->GetSession())
{
- WorldSession* session = handler->GetSession();
- if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat())
- session->SendNotification(LANG_GM_CHAT_ON);
- else
- session->SendNotification(LANG_GM_CHAT_OFF);
- return true;
- }
+ if (!*args)
+ {
+ if (session->HasPermission(RBAC_PERM_CHAT_USE_STAFF_BADGE) && session->GetPlayer()->isGMChat())
+ session->SendNotification(LANG_GM_CHAT_ON);
+ else
+ session->SendNotification(LANG_GM_CHAT_OFF);
+ return true;
+ }
- std::string param = (char*)args;
+ std::string param = (char*)args;
- if (param == "on")
- {
- handler->GetSession()->GetPlayer()->SetGMChat(true);
- handler->GetSession()->SendNotification(LANG_GM_CHAT_ON);
- return true;
- }
+ if (param == "on")
+ {
+ session->GetPlayer()->SetGMChat(true);
+ session->SendNotification(LANG_GM_CHAT_ON);
+ return true;
+ }
- if (param == "off")
- {
- handler->GetSession()->GetPlayer()->SetGMChat(false);
- handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF);
- return true;
+ if (param == "off")
+ {
+ session->GetPlayer()->SetGMChat(false);
+ session->SendNotification(LANG_GM_CHAT_OFF);
+ return true;
+ }
}
handler->SendSysMessage(LANG_USE_BOL);
@@ -126,7 +128,9 @@ public:
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
AccountTypes itrSec = itr->second->GetSession()->GetSecurity();
- if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itrSec) && itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
+ if ((itr->second->isGameMaster() ||
+ (itr->second->GetSession()->HasPermission(RBAC_PERM_COMMANDS_APPEAR_IN_GM_LIST) &&
+ itrSec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
(!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer())))
{
if (first)
diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp
index 7f39a8fc024..aa9d9308bcd 100644
--- a/src/server/scripts/Commands/cs_lfg.cpp
+++ b/src/server/scripts/Commands/cs_lfg.cpp
@@ -28,12 +28,12 @@ void GetPlayerInfo(ChatHandler* handler, Player* player)
return;
uint64 guid = player->GetGUID();
- LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid);
+ lfg::LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid);
- std::string const& state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid));
+ std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
handler->PSendSysMessage(LANG_LFG_PLAYER_INFO, player->GetName().c_str(),
- state.c_str(), uint8(dungeons.size()), sLFGMgr->ConcatenateDungeons(dungeons).c_str(),
- sLFGMgr->GetRolesString(sLFGMgr->GetRoles(guid)).c_str(), sLFGMgr->GetComment(guid).c_str());
+ state.c_str(), uint8(dungeons.size()), lfg::ConcatenateDungeons(dungeons).c_str(),
+ lfg::GetRolesString(sLFGMgr->GetRoles(guid)).c_str(), sLFGMgr->GetComment(guid).c_str());
}
class lfg_commandscript : public CommandScript
@@ -87,7 +87,7 @@ public:
}
uint64 guid = grp->GetGUID();
- std::string const& state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid));
+ std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(),
state.c_str(), sLFGMgr->GetDungeon(guid));
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index e2b5ac9487d..4cdc1e0d9ce 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -33,6 +33,8 @@
#include "ace/INET_Addr.h"
#include "Player.h"
#include "Pet.h"
+#include "LFG.h"
+#include "GroupMgr.h"
class misc_commandscript : public CommandScript
{
@@ -47,6 +49,7 @@ public:
{ "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL },
{ "join", SEC_ADMINISTRATOR, false, &HandleGroupJoinCommand, "", NULL },
+ { "list", SEC_ADMINISTRATOR, false, &HandleGroupListCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand petCommandTable[] =
@@ -675,7 +678,7 @@ public:
if (target)
{
- target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
+ target->ResurrectPlayer(target->GetSession()->HasPermission(RBAC_PERM_RESURRECT_WITH_FULL_HPS) ? 1.0f : 0.5f);
target->SpawnCorpseBones();
target->SaveToDB();
}
@@ -878,7 +881,7 @@ public:
Player* player = handler->GetSession()->GetPlayer();
// save GM account without delay and output message
- if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ if (handler->GetSession()->HasPermission(RBAC_PERM_COMMANDS_SAVE_WITHOUT_DELAY))
{
if (Player* target = handler->getSelectedPlayer())
target->SaveToDB();
@@ -935,8 +938,8 @@ public:
static bool HandleUnstuckCommand(ChatHandler* handler, char const* args)
{
- //No args required for players
- if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ // No args required for players
+ if (handler->GetSession() && !handler->GetSession()->HasPermission(RBAC_PERM_COMMANDS_USE_UNSTUCK_WITH_ARGS))
{
// 7355: "Stuck"
if (Player* player = handler->GetSession()->GetPlayer())
@@ -1547,6 +1550,8 @@ public:
std::string userName = handler->GetTrinityString(LANG_ERROR);
std::string eMail = handler->GetTrinityString(LANG_ERROR);
+ std::string muteReason = "";
+ std::string muteBy = "";
std::string lastIp = handler->GetTrinityString(LANG_ERROR);
uint32 security = 0;
std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
@@ -1563,6 +1568,8 @@ public:
security = fields[1].GetUInt8();
eMail = fields[2].GetString();
muteTime = fields[5].GetUInt64();
+ muteReason = fields[6].GetString();
+ muteBy = fields[7].GetString();
if (eMail.empty())
eMail = "-";
@@ -1624,7 +1631,7 @@ public:
}
if (muteTime > 0)
- handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());
+ handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str(), muteBy.c_str(), muteReason.c_str());
if (banTime >= 0)
handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
@@ -1731,6 +1738,23 @@ public:
else
handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+
+ result = CharacterDatabase.Query(stmt);
+ if (result)
+ {
+ Field* fields = result->Fetch();
+
+ uint32 guildId = fields[0].GetUInt32();
+ std::string guildName = fields[1].GetString();
+ std::string guildRank = fields[2].GetString();
+ std::string note = fields[3].GetString();
+ std::string officeNote = fields[4].GetString();
+
+ handler->PSendSysMessage(LANG_PINFO_GUILD_INFO, guildName.c_str(), guildId, guildRank.c_str(), note.c_str(), officeNote.c_str());
+ }
+
return true;
}
@@ -1800,6 +1824,11 @@ public:
return false;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+ std::string muteBy = "";
+ if (handler->GetSession())
+ muteBy = handler->GetSession()->GetPlayerName();
+ else
+ muteBy = "Console";
if (target)
{
@@ -1807,7 +1836,7 @@ public:
int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
target->GetSession()->m_muteTime = muteTime;
stmt->setInt64(0, muteTime);
- ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str());
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
}
else
{
@@ -1816,7 +1845,9 @@ public:
stmt->setInt64(0, muteTime);
}
- stmt->setUInt32(1, accountId);
+ stmt->setString(1, muteReasonStr.c_str());
+ stmt->setString(2, muteBy.c_str());
+ stmt->setUInt32(3, accountId);
LoginDatabase.Execute(stmt);
std::string nameLink = handler->playerLink(targetName);
@@ -1859,7 +1890,9 @@ public:
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
stmt->setInt64(0, 0);
- stmt->setUInt32(1, accountId);
+ stmt->setString(1, "");
+ stmt->setString(2, "");
+ stmt->setUInt32(3, accountId);
LoginDatabase.Execute(stmt);
if (target)
@@ -2781,6 +2814,77 @@ public:
return true;
}
+ static bool HandleGroupListCommand(ChatHandler* handler, char const* args)
+ {
+ Player* playerTarget;
+ uint64 guidTarget;
+ std::string nameTarget;
+
+ uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+
+ if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))
+ {
+ playerTarget = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ guidTarget = parseGUID;
+ }
+ else if (!handler->extractPlayerTarget((char*)args, &playerTarget, &guidTarget, &nameTarget))
+ return false;
+
+ Group* groupTarget = NULL;
+ if (playerTarget)
+ groupTarget = playerTarget->GetGroup();
+
+ if (!groupTarget)
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER);
+ stmt->setUInt32(0, guidTarget);
+ PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt);
+ if (resultGroup)
+ groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32());
+ }
+
+ if (groupTarget)
+ {
+ handler->PSendSysMessage(LANG_GROUP_TYPE, (groupTarget->isRaidGroup() ? "raid" : "party"));
+ Group::MemberSlotList const& members = groupTarget->GetMemberSlots();
+ for (Group::MemberSlotList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
+ {
+ Group::MemberSlot const& slot = *itr;
+
+ std::string flags;
+ if (slot.flags & MEMBER_FLAG_ASSISTANT)
+ flags = "Assistant";
+
+ if (slot.flags & MEMBER_FLAG_MAINTANK)
+ {
+ if (!flags.empty())
+ flags.append(", ");
+ flags.append("MainTank");
+ }
+
+ if (slot.flags & MEMBER_FLAG_MAINASSIST)
+ {
+ if (!flags.empty())
+ flags.append(", ");
+ flags.append("MainAssist");
+ }
+
+ if (flags.empty())
+ flags = "None";
+
+ Player* p = ObjectAccessor::FindPlayer((*itr).guid);
+ const char* onlineState = (p && p->IsInWorld()) ? "online" : "offline";
+
+ handler->PSendSysMessage(LANG_GROUP_PLAYER_NAME_GUID, slot.name.c_str(), onlineState,
+ GUID_LOPART(slot.guid), flags.c_str(), lfg::GetRolesString(slot.roles).c_str());
+ }
+ }
+ else
+ handler->PSendSysMessage(LANG_GROUP_NOT_IN_GROUP, nameTarget.c_str());
+
+ return true;
+ }
+
static bool HandlePlayAllCommand(ChatHandler* handler, char const* args)
{
if (!*args)
diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp
index 97861133983..79cd0deb75e 100644
--- a/src/server/scripts/Commands/cs_mmaps.cpp
+++ b/src/server/scripts/Commands/cs_mmaps.cpp
@@ -95,7 +95,7 @@ public:
path.SetUseStraightPath(useStraightPath);
bool result = path.CalculatePath(x, y, z);
- PointsArray pointPath = path.GetPath();
+ PointsArray const& pointPath = path.GetPath();
handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str());
handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath");
handler->PSendSysMessage("Result: %s - Length: "SIZEFMTD" - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 01648f25cff..eaed64db579 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -1046,9 +1046,12 @@ public:
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd);
if (moneyToAdd >= MAX_MONEY_AMOUNT)
- target->SetMoney(MAX_MONEY_AMOUNT);
- else
- target->ModifyMoney(moneyToAdd);
+ moneyToAdd = MAX_MONEY_AMOUNT;
+
+ if (targetMoney >= uint32(MAX_MONEY_AMOUNT) - moneyToAdd)
+ moneyToAdd -= targetMoney;
+
+ target->ModifyMoney(moneyToAdd);
}
sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney());
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 7ccd5ed1177..8dc466296fd 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -645,6 +645,7 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetDBTableGUIDLow(), target->GetGUIDLow(), faction, npcflags, Entry, displayid, nativeid);
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
+ handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction());
handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
@@ -652,7 +653,7 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId());
handler->PSendSysMessage(LANG_NPCINFO_PHASEMASK, target->GetPhaseMask());
handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor());
- handler->PSendSysMessage(LANG_NPCINFO_POSITION, float(target->GetPositionX()), float(target->GetPositionY()), float(target->GetPositionZ()));
+ handler->PSendSysMessage(LANG_NPCINFO_POSITION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
for (uint8 i = 0; i < NPCFLAG_COUNT; i++)
diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp
new file mode 100644
index 00000000000..604218c2e68
--- /dev/null
+++ b/src/server/scripts/Commands/cs_rbac.cpp
@@ -0,0 +1,780 @@
+/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: rbac_commandscript
+%Complete: 100
+Comment: All role based access control related commands (including account related)
+Category: commandscripts
+EndScriptData */
+
+#include "AccountMgr.h"
+#include "Config.h"
+#include "Chat.h"
+#include "Language.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+
+struct RBACCommandData
+{
+ RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { }
+ uint32 id;
+ int32 realmId;
+ RBACData* rbac;
+ bool needDelete;
+};
+
+class rbac_commandscript : public CommandScript
+{
+public:
+ rbac_commandscript() : CommandScript("rbac_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand rbacGroupsCommandTable[] =
+ {
+ { "add", SEC_ADMINISTRATOR, true, &HandleRBACGroupAddCommand, "", NULL },
+ { "remove", SEC_ADMINISTRATOR, true, &HandleRBACGroupRemoveCommand, "", NULL },
+ { "", SEC_ADMINISTRATOR, true, &HandleRBACGroupListCommand, "", NULL },
+ { NULL, SEC_ADMINISTRATOR, false, NULL, "", NULL }
+ };
+
+ static ChatCommand rbacRolesCommandTable[] =
+ {
+ { "grant", SEC_ADMINISTRATOR, true, &HandleRBACRoleGrantCommand, "", NULL },
+ { "deny", SEC_ADMINISTRATOR, true, &HandleRBACRoleDenyCommand, "", NULL },
+ { "revoke", SEC_ADMINISTRATOR, true, &HandleRBACRoleRevokeCommand, "", NULL },
+ { "", SEC_ADMINISTRATOR, true, &HandleRBACRoleListCommand, "", NULL },
+ { NULL, SEC_ADMINISTRATOR, false, NULL, "", NULL }
+ };
+
+ static ChatCommand rbacPermsCommandTable[] =
+ {
+ { "grant", SEC_ADMINISTRATOR, true, &HandleRBACPermGrantCommand, "", NULL },
+ { "deny", SEC_ADMINISTRATOR, true, &HandleRBACPermDenyCommand, "", NULL },
+ { "revoke", SEC_ADMINISTRATOR, true, &HandleRBACPermRevokeCommand, "", NULL },
+ { "", SEC_ADMINISTRATOR, true, &HandleRBACPermListCommand, "", NULL },
+ { NULL, SEC_ADMINISTRATOR, false, NULL, "", NULL }
+ };
+
+ static ChatCommand rbacListCommandTable[] =
+ {
+ { "groups", SEC_ADMINISTRATOR, true, &HandleRBACListGroupsCommand, "", NULL },
+ { "roles", SEC_ADMINISTRATOR, true, &HandleRBACListRolesCommand, "", NULL },
+ { "permissions", SEC_ADMINISTRATOR, true, &HandleRBACListPermissionsCommand, "", NULL },
+ { NULL, SEC_ADMINISTRATOR, false, NULL, "", NULL }
+ };
+
+ static ChatCommand rbacAccountCommandTable[] =
+ {
+ { "group", SEC_ADMINISTRATOR, true, NULL, "", rbacGroupsCommandTable },
+ { "role", SEC_ADMINISTRATOR, true, NULL, "", rbacRolesCommandTable },
+ { "permission", SEC_ADMINISTRATOR, true, NULL, "", rbacPermsCommandTable },
+ { "", SEC_ADMINISTRATOR, true, &HandleRBACAccountPermissionCommand, "", NULL },
+ { NULL, SEC_ADMINISTRATOR, false, NULL, "", NULL }
+ };
+
+ static ChatCommand rbacCommandTable[] =
+ {
+ { "account", SEC_ADMINISTRATOR, true, NULL, "", rbacAccountCommandTable },
+ { "list", SEC_ADMINISTRATOR, true, NULL, "", rbacListCommandTable },
+ { NULL, SEC_ADMINISTRATOR, false, NULL, "", NULL }
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "rbac", SEC_ADMINISTRATOR, true, NULL, "", rbacCommandTable },
+ { NULL, SEC_ADMINISTRATOR, false, NULL, "", NULL }
+ };
+
+ return commandTable;
+ }
+
+ static RBACCommandData* ReadParams(ChatHandler* handler, char const* args, bool checkParams = true)
+ {
+ if (!args)
+ return NULL;
+
+ char* param1 = strtok((char*)args, " ");
+ char* param2 = strtok(NULL, " ");
+ char* param3 = strtok(NULL, " ");
+
+ int32 realmId = -1;
+ uint32 accountId = 0;
+ std::string accountName;
+ uint32 id = 0;
+ RBACCommandData* data = NULL;
+ RBACData* rdata = NULL;
+ bool useSelectedPlayer = false;
+
+ if (checkParams)
+ {
+ if (!param3)
+ {
+ if (param2)
+ realmId = atoi(param2);
+
+ if (param1)
+ id = atoi(param1);
+
+ useSelectedPlayer = true;
+ }
+ else
+ {
+ id = atoi(param2);
+ realmId = atoi(param3);
+ }
+
+ if (!id)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
+ handler->SetSentErrorMessage(true);
+ return NULL;
+ }
+
+ if (realmId < -1 || !realmId)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_REALM, realmId);
+ handler->SetSentErrorMessage(true);
+ return NULL;
+ }
+ }
+ else if (!param1)
+ useSelectedPlayer = true;
+
+ if (useSelectedPlayer)
+ {
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ return NULL;
+
+ rdata = player->GetSession()->GetRBACData();
+ accountId = rdata->GetId();
+ AccountMgr::GetName(accountId, accountName);
+ }
+ else
+ {
+ accountName = param1;
+
+ if (AccountMgr::normalizeString(accountName))
+ accountId = AccountMgr::GetId(accountName);
+
+ if (!accountId)
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return NULL;
+ }
+ }
+
+ if (checkParams && handler->HasLowerSecurityAccount(NULL, accountId, true))
+ return NULL;
+
+ data = new RBACCommandData();
+
+ if (!rdata)
+ {
+ data->rbac = new RBACData(accountId, accountName, realmID);
+ data->rbac->LoadFromDB();
+ data->needDelete = true;
+ }
+ else
+ data->rbac = rdata;
+
+ data->id = id;
+ data->realmId = realmId;
+ return data;
+ }
+
+ static bool HandleRBACGroupAddCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->AddGroup(command->id, command->realmId);
+ RBACGroup const* group = sAccountMgr->GetRBACGroup(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_ADD_ALREADY_ADDED:
+ handler->PSendSysMessage(LANG_RBAC_GROUP_IN_LIST, command->id, group->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_GROUP_ADDED, command->id, group->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACGroupRemoveCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->RemoveGroup(command->id, command->realmId);
+ RBACGroup const* group = sAccountMgr->GetRBACGroup(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_REVOKE_NOT_IN_LIST:
+ handler->PSendSysMessage(LANG_RBAC_GROUP_NOT_IN_LIST, command->id, group->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_GROUP_REMOVED, command->id, group->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACGroupListCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args, false);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_GROUP_LIST_HEADER, command->rbac->GetId(), command->rbac->GetName().c_str());
+ RBACGroupContainer const& groups = command->rbac->GetGroups();
+ if (groups.empty())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (RBACGroupContainer::const_iterator it = groups.begin(); it != groups.end(); ++it)
+ {
+ RBACGroup const* group = sAccountMgr->GetRBACGroup(*it);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, group->GetId(), group->GetName().c_str());
+ }
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACRoleGrantCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->GrantRole(command->id, command->realmId);
+ RBACRole const* role = sAccountMgr->GetRBACRole(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_ADD_ALREADY_ADDED:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_GRANTED_IN_LIST, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_IN_DENIED_LIST:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_GRANTED_IN_DENIED_LIST, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_GRANTED, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACRoleDenyCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->DenyRole(command->id, command->realmId);
+ RBACRole const* role = sAccountMgr->GetRBACRole(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_ADD_ALREADY_ADDED:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_DENIED_IN_LIST, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_IN_GRANTED_LIST:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_DENIED_IN_GRANTED_LIST, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_DENIED, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACRoleRevokeCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->RevokeRole(command->id, command->realmId);
+ RBACRole const* role = sAccountMgr->GetRBACRole(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_REVOKE_NOT_IN_LIST:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_REVOKED_NOT_IN_LIST, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_ROLE_REVOKED, command->id, role->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACRoleListCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args, false);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_ROLE_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
+ RBACGroupContainer const& granted = command->rbac->GetGrantedRoles();
+ if (granted.empty())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (RBACRoleContainer::const_iterator it = granted.begin(); it != granted.end(); ++it)
+ {
+ RBACRole const* role = sAccountMgr->GetRBACRole(*it);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, role->GetId(), role->GetName().c_str());
+ }
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_ROLE_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
+ RBACGroupContainer const& denied = command->rbac->GetDeniedRoles();
+ if (denied.empty())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (RBACRoleContainer::const_iterator it = denied.begin(); it != denied.end(); ++it)
+ {
+ RBACRole const* role = sAccountMgr->GetRBACRole(*it);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, role->GetId(), role->GetName().c_str());
+ }
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACPermGrantCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->GrantPermission(command->id, command->realmId);
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_ADD_ALREADY_ADDED:
+ handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_IN_DENIED_LIST:
+ handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_DENIED_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACPermDenyCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->DenyPermission(command->id, command->realmId);
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_ADD_ALREADY_ADDED:
+ handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_IN_GRANTED_LIST:
+ handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_GRANTED_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_PERM_DENIED, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACPermRevokeCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ RBACCommandResult result = command->rbac->RevokePermission(command->id, command->realmId);
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
+
+ switch (result)
+ {
+ case RBAC_CANT_REVOKE_NOT_IN_LIST:
+ handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED_NOT_IN_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACPermListCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args, false);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_PERM_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
+ RBACPermissionContainer const& granted = command->rbac->GetGrantedPermissions();
+ if (!granted.any())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (uint32 i = 0; i < RBAC_PERM_MAX; ++i)
+ if (granted.test(i))
+ {
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(i);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_PERM_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
+ RBACPermissionContainer const& denied = command->rbac->GetDeniedPermissions();
+ if (!denied.any())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (uint32 i = 0; i < RBAC_PERM_MAX; ++i)
+ if (denied.test(i))
+ {
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(i);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACAccountPermissionCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args, false);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_PERM_LIST_GLOBAL, command->rbac->GetId(), command->rbac->GetName().c_str());
+ RBACPermissionContainer const& permissions = command->rbac->GetPermissions();
+ if (!permissions.any())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (uint32 i = 0; i < RBAC_PERM_MAX; ++i)
+ if (permissions.test(i))
+ {
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(i);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+
+ if (command->needDelete)
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACListGroupsCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 id = 0;
+ if (char* param1 = strtok((char*)args, " "))
+ id = atoi(param1);
+
+ if (!id)
+ {
+ RBACGroupsContainer const& groups = sAccountMgr->GetRBACGroupList();
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_GROUPS_HEADER));
+ for (RBACGroupsContainer::const_iterator it = groups.begin(); it != groups.end(); ++it)
+ {
+ RBACGroup const* group = it->second;
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, group->GetId(), group->GetName().c_str());
+ }
+ }
+ else
+ {
+ RBACGroup const* group = sAccountMgr->GetRBACGroup(id);
+ if (!group)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_GROUPS_HEADER));
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, group->GetId(), group->GetName().c_str());
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_ROLES_HEADER));
+ RBACRoleContainer const& roles = group->GetRoles();
+ if (roles.empty())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (RBACRoleContainer::const_iterator it = roles.begin(); it != roles.end(); ++it)
+ {
+ RBACRole const* role = sAccountMgr->GetRBACRole(*it);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, role->GetId(), role->GetName().c_str());
+ }
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleRBACListRolesCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 id = 0;
+ if (char* param1 = strtok((char*)args, " "))
+ id = atoi(param1);
+
+ if (!id)
+ {
+ RBACRolesContainer const& roles = sAccountMgr->GetRBACRoleList();
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_ROLES_HEADER));
+ for (RBACRolesContainer::const_iterator it = roles.begin(); it != roles.end(); ++it)
+ {
+ RBACRole const* role = it->second;
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, role->GetId(), role->GetName().c_str());
+ }
+ }
+ else
+ {
+ RBACRole const* role = sAccountMgr->GetRBACRole(id);
+ if (!role)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_ROLES_HEADER));
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, role->GetId(), role->GetName().c_str());
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
+ RBACPermissionContainer const& permissions = role->GetPermissions();
+ if (!permissions.any())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (uint32 i = 0; i < RBAC_PERM_MAX; ++i)
+ if (permissions.test(i))
+ {
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(i);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleRBACListPermissionsCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 id = 0;
+ if (char* param1 = strtok((char*)args, " "))
+ id = atoi(param1);
+
+ if (!id)
+ {
+ RBACPermissionsContainer const& permissions = sAccountMgr->GetRBACPermissionList();
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
+ for (RBACPermissionsContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
+ {
+ RBACPermission const* permission = it->second;
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+ else
+ {
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(id);
+ if (!permission)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+
+ return true;
+ }
+};
+
+void AddSC_rbac_commandscript()
+{
+ new rbac_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 43c2001fbf7..b2542d6a668 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -508,10 +508,9 @@ public:
cInfo->questItems[5] = fields[78].GetUInt32();
cInfo->movementId = fields[79].GetUInt32();
cInfo->RegenHealth = fields[80].GetBool();
- cInfo->equipmentId = fields[81].GetUInt32();
- cInfo->MechanicImmuneMask = fields[82].GetUInt32();
- cInfo->flags_extra = fields[83].GetUInt32();
- cInfo->ScriptID = sObjectMgr->GetScriptId(fields[84].GetCString());
+ cInfo->MechanicImmuneMask = fields[81].GetUInt32();
+ cInfo->flags_extra = fields[82].GetUInt32();
+ cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString());
sObjectMgr->CheckCreatureTemplate(cInfo);
}
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
index aee01f47581..958eb1709d5 100644
--- a/src/server/scripts/Commands/cs_ticket.cpp
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -95,18 +95,16 @@ public:
return true;
}
- // Get target information
- uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
- uint64 targetAccountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
- uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realmID);
-
+ uint32 accountId = AccountMgr::GetId(target);
// Target must exist and have administrative rights
- if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
+ if (!AccountMgr::HasPermission(accountId, RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET, realmID))
{
handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
return true;
}
+ uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target);
+
// If already assigned, leave
if (ticket->IsAssignedTo(targetGuid))
{
@@ -125,7 +123,7 @@ public:
// Assign ticket
SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
+ ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(AccountMgr::GetSecurity(accountId, realmID)));
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
index 809bd2440d7..d301e702174 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
@@ -104,7 +104,7 @@ class mob_av_marshal_or_warmaster : public CreatureScript
Reset();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// I have a feeling this isn't blizzlike, but owell, I'm only passing by and cleaning up.
if (!_hasAura)
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 5622e91cd73..6dec1796500 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
@@ -62,7 +62,7 @@ public:
resetTimer = 5 * IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -145,7 +145,7 @@ public:
summons.DespawnAll();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
index 6e2738d79ca..745c310d35c 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
@@ -75,7 +75,7 @@ public:
Talk(YELL_RESPAWN);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
index fea8573d6f8..2cf7d7cafef 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
@@ -69,7 +69,7 @@ public:
Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
index 732bbc6f1ba..6939890a702 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
@@ -64,7 +64,7 @@ public:
Talk(YELL_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
index 071e0c4dd19..0c8092013aa 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
@@ -222,7 +222,7 @@ public:
instance->HandleGameObject(instance->GetData64(id), open);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance)
return;
@@ -372,7 +372,7 @@ public:
MightyBlow_Timer = 15000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -648,7 +648,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return;
if ((instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& instance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED)
@@ -807,7 +807,7 @@ public:
instance->SetData(DATA_QUEST_JAIL_BREAK, ENCOUNTER_STATE_FAILED);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED)
return;
@@ -1017,7 +1017,7 @@ public:
instance->SetData(DATA_QUEST_JAIL_BREAK, ENCOUNTER_STATE_FAILED);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED)
return;
@@ -1151,7 +1151,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED)
return;
@@ -1284,7 +1284,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance)
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
index 99619a89bf3..c5d93ad0c85 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
@@ -55,7 +55,7 @@ public:
Spirit->AI()->AttackStart(victim);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
index 424489fc703..bb4de5b347a 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
@@ -59,7 +59,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
index 3a7baff0196..aaf0adc57c4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
@@ -81,7 +81,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
index 8c2c590e3e5..bd5a06bf46c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
@@ -69,7 +69,7 @@ public:
SummonedMedic->AI()->AttackStart(victim);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
index 4f876f41907..02c00b4958c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
@@ -52,7 +52,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
index 51fddc0f71f..a0ab6f9939c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
@@ -51,7 +51,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
index 0631a4308df..a901bc3d5e3 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
@@ -56,7 +56,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
index fa8a13f1bfd..5c496ed597b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
@@ -55,7 +55,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
index 3142610b346..bb528de9dca 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
@@ -58,7 +58,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
index f4e9d561b5e..2767c76a69e 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -202,7 +202,7 @@ public:
instance->SetData(DATA_GHOSTKILL, 1);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp
index fa1f79d82e7..7081974195f 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp
@@ -69,7 +69,7 @@ public:
_JustDied();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp
index cef633ac2d8..7a4f1aac17d 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp
@@ -92,7 +92,7 @@ public:
Summoned->AddThreat(target, 250.0f);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp
index 2f9d39152e3..af0e5110523 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp
@@ -68,7 +68,7 @@ public:
_JustDied();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp
index afb6ab75649..082e1f8e79b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp
@@ -78,7 +78,7 @@ public:
_JustDied();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp
index d67fa7c5caa..fc6d3f7d4db 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp
@@ -70,7 +70,7 @@ public:
DoCast(me, SPELL_SUMMON_SPIRE_SPIDERLING, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp
index ff68462ffb5..09d85a680b8 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp
@@ -81,7 +81,7 @@ public:
_JustDied();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp
index da38fe9f54b..44a27e6938f 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp
@@ -97,7 +97,7 @@ public:
door3->SetGoState(GO_STATE_ACTIVE);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp
index 2f86c009d56..8828fcfe753 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp
@@ -65,7 +65,7 @@ public:
_JustDied();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp
index b881f94dda9..b8d9377d7c4 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp
@@ -66,7 +66,7 @@ public:
_JustDied();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp
index 69ebf33248f..c429931d42b 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp
@@ -67,7 +67,7 @@ public:
_JustDied();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp
index f8f4f64b618..a32fefeca40 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp
@@ -66,7 +66,7 @@ public:
_JustDied();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp
index 7d4c7a40d61..056448854dc 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp
@@ -75,7 +75,7 @@ public:
_JustDied();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
index 0aeba151385..73afebfa9f3 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
@@ -32,12 +32,20 @@ enum Say
SAY_LEASH = 1,
};
+enum Events
+{
+ EVENT_CLEAVE = 1,
+ EVENT_MORTAL_STRIKE = 2,
+ EVENT_BLAST_WAVE = 3,
+ EVENT_KNOCK_BACK = 4,
+};
+
enum Spells
{
SPELL_CLEAVE = 26350,
- SPELL_BLASTWAVE = 23331,
- SPELL_MORTALSTRIKE = 24573,
- SPELL_KNOCKBACK = 25778
+ SPELL_BLAST_WAVE = 23331,
+ SPELL_MORTAL_STRIKE = 24573,
+ SPELL_KNOCK_BACK = 25778
};
class boss_broodlord : public CreatureScript
@@ -54,17 +62,13 @@ public:
{
boss_broodlordAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 Cleave_Timer;
- uint32 BlastWave_Timer;
- uint32 MortalStrike_Timer;
- uint32 KnockBack_Timer;
-
void Reset()
{
- Cleave_Timer = 8000; // These times are probably wrong
- BlastWave_Timer = 12000;
- MortalStrike_Timer = 20000;
- KnockBack_Timer = 30000;
+ // These timers are probably wrong
+ events.ScheduleEvent(EVENT_CLEAVE, 8000);
+ events.ScheduleEvent(EVENT_BLAST_WAVE, 12000);
+ events.ScheduleEvent(EVENT_MORTAL_STRIKE, 20000);
+ events.ScheduleEvent(EVENT_KNOCK_BACK, 30000);
}
void EnterCombat(Unit* /*who*/)
@@ -73,47 +77,56 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
- //Cleave_Timer
- if (Cleave_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_CLEAVE);
- Cleave_Timer = 7000;
- } else Cleave_Timer -= diff;
-
- // BlastWave
- if (BlastWave_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_BLASTWAVE);
- BlastWave_Timer = urand(8000, 16000);
- } else BlastWave_Timer -= diff;
+ if (EnterEvadeIfOutOfCombatArea(diff))
+ Talk(SAY_LEASH);
- //MortalStrike_Timer
- if (MortalStrike_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_MORTALSTRIKE);
- MortalStrike_Timer = urand(25000, 35000);
- } else MortalStrike_Timer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (KnockBack_Timer <= diff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- DoCast(me->getVictim(), SPELL_KNOCKBACK);
- //Drop 50% aggro
- if (DoGetThreat(me->getVictim()))
- DoModifyThreatPercent(me->getVictim(), -50);
-
- KnockBack_Timer = urand(15000, 30000);
- } else KnockBack_Timer -= diff;
+ switch (eventId)
+ {
+ case EVENT_CLEAVE:
+ DoCastVictim(SPELL_CLEAVE);
+ events.ScheduleEvent(EVENT_CLEAVE, 8000);
+ break;
+ case EVENT_MORTAL_STRIKE:
+ DoCastVictim(SPELL_MORTAL_STRIKE);
+ events.ScheduleEvent(EVENT_MORTAL_STRIKE, 20000);
+ break;
+ case EVENT_BLAST_WAVE:
+ DoCastVictim(SPELL_BLAST_WAVE);
+ events.ScheduleEvent(EVENT_BLAST_WAVE, 12000);
+ break;
+ case EVENT_KNOCK_BACK:
+ if (Unit* target = me->getVictim())
+ {
+ DoCast(target, SPELL_BLAST_WAVE);
+ // Drop 50% of threat
+ if (DoGetThreat(target))
+ DoModifyThreatPercent(target, -50);
+ }
+ events.ScheduleEvent(EVENT_KNOCK_BACK, 30000);
+ break;
+ default:
+ break;
+ }
+ }
if (EnterEvadeIfOutOfCombatArea(diff))
Talk(SAY_LEASH);
DoMeleeAttackIfReady();
}
+
+ private:
+ EventMap events; /// @todo: change BWL to instance script and bosses to BossAI
};
};
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
index 14e4e90337c..c7459ed2f7d 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
@@ -200,7 +200,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
index 54c1ba99e8d..a9b41b719f7 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
@@ -27,9 +27,10 @@ EndScriptData */
#include "ScriptedCreature.h"
#define SPELL_SHADOWFLAME 22539
-#define SPELL_WINGBUFFET 18500
+#define SPELL_WINGBUFFET 23339
#define SPELL_SHADOWOFEBONROC 23340
-#define SPELL_HEAL 41386 //Thea Heal spell of his Shadow
+#define SPELL_HEAL 41386 //The Heal spell of his Shadow
+#define SPELL_THRASH 3391
class boss_ebonroc : public CreatureScript
{
@@ -49,6 +50,7 @@ public:
uint32 WingBuffet_Timer;
uint32 ShadowOfEbonroc_Timer;
uint32 Heal_Timer;
+ uint32 Thrash_Timer;
void Reset()
{
@@ -56,6 +58,7 @@ public:
WingBuffet_Timer = 30000;
ShadowOfEbonroc_Timer = 45000;
Heal_Timer = 1000;
+ Thrash_Timer = 10000;
}
void EnterCombat(Unit* /*who*/)
@@ -63,7 +66,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -75,6 +78,13 @@ public:
ShadowFlame_Timer = urand(12000, 15000);
} else ShadowFlame_Timer -= diff;
+ //Thrash Timer
+ if (Thrash_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_THRASH);
+ Thrash_Timer = urand(10000, 15000);
+ } else Thrash_Timer -= diff;
+
//Wing Buffet Timer
if (WingBuffet_Timer <= diff)
{
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
index 7ca74f4ed4f..3b63d67814e 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
@@ -60,7 +60,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -68,24 +68,26 @@ public:
//ShadowFlame_Timer
if (ShadowFlame_Timer <= diff)
{
- DoCast(me->getVictim(), SPELL_SHADOWFLAME);
+ DoCastVictim(SPELL_SHADOWFLAME);
ShadowFlame_Timer = urand(15000, 18000);
} else ShadowFlame_Timer -= diff;
//WingBuffet_Timer
if (WingBuffet_Timer <= diff)
{
- DoCast(me->getVictim(), SPELL_WINGBUFFET);
- if (DoGetThreat(me->getVictim()))
- DoModifyThreatPercent(me->getVictim(), -75);
-
+ if (Unit* target = me->getVictim())
+ {
+ DoCast(target, SPELL_WINGBUFFET);
+ if (DoGetThreat(target))
+ DoModifyThreatPercent(target, -75);
+ }
WingBuffet_Timer = 25000;
} else WingBuffet_Timer -= diff;
//FlameBuffet_Timer
if (FlameBuffet_Timer <= diff)
{
- DoCast(me->getVictim(), SPELL_FLAMEBUFFET);
+ DoCastVictim(SPELL_FLAMEBUFFET);
FlameBuffet_Timer = 5000;
} else FlameBuffet_Timer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
index a1659330a6f..f90389bc4eb 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
@@ -68,7 +68,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -76,17 +76,19 @@ public:
//ShadowFlame_Timer
if (ShadowFlame_Timer <= diff)
{
- DoCast(me->getVictim(), SPELL_SHADOWFLAME);
+ DoCastVictim(SPELL_SHADOWFLAME);
ShadowFlame_Timer = urand(15000, 22000);
} else ShadowFlame_Timer -= diff;
//WingBuffet_Timer
if (WingBuffet_Timer <= diff)
{
- DoCast(me->getVictim(), SPELL_WINGBUFFET);
- if (DoGetThreat(me->getVictim()))
- DoModifyThreatPercent(me->getVictim(), -75);
-
+ if (Unit* target = me->getVictim())
+ {
+ DoCast(target, SPELL_WINGBUFFET);
+ if (DoGetThreat(target))
+ DoModifyThreatPercent(target, -75);
+ }
WingBuffet_Timer = 25000;
} else WingBuffet_Timer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
index 5594d826fdf..f96d6c4a562 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
@@ -123,7 +123,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (DespawnTimer <= diff)
{
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
index b8361da5eb8..ebf6298b79d 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
@@ -81,7 +81,7 @@ public:
Talk(SAY_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
index 45a9eb397eb..e07da353e90 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
@@ -156,7 +156,7 @@ public:
me->ResetPlayerDamageReq();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Speech
if (DoingSpeech)
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
index 86709e5e6b5..8a781b48e90 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
@@ -270,7 +270,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
index eb8fc77717c..060c2e0506f 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
@@ -94,7 +94,7 @@ public:
return true;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index 6b0d39d7223..558ffaf7135 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -572,7 +572,7 @@ public:
CAST_CRE(summon)->AI()->SetData(2, 1);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
index bcdd1a9671a..9dab7439136 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
@@ -95,7 +95,7 @@ public:
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 a431a3e10e7..52d9c697452 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
@@ -89,7 +89,7 @@ public:
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 8347e1c114d..1bbc1bc98fa 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -104,7 +104,7 @@ public:
midnight->Kill(midnight);
}
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
void SpellHit(Unit* /*source*/, const SpellInfo* spell)
{
@@ -153,7 +153,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -234,7 +234,7 @@ public:
};
};
-void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff)
+void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff)
{
if (ResetTimer)
{
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index 5c7c39e3725..f3bc733e722 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -228,7 +228,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -354,7 +354,7 @@ struct boss_moroes_guestAI : public ScriptedAI
return me;
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (instance && !instance->GetData(TYPE_MOROES))
EnterEvadeMode();
@@ -421,7 +421,7 @@ public:
boss_moroes_guestAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -482,7 +482,7 @@ public:
boss_moroes_guestAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -543,7 +543,7 @@ public:
boss_moroes_guestAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -613,7 +613,7 @@ public:
boss_moroes_guestAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -683,7 +683,7 @@ public:
boss_moroes_guestAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -741,7 +741,7 @@ public:
boss_moroes_guestAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index dd9b97386b4..305e37a72d3 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -269,7 +269,7 @@ public:
DestroyPortals();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
index 6d9a1f98e93..8165ba5c53b 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -260,7 +260,7 @@ public:
Skeletons = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
/* The timer for this was never setup apparently, not sure if the code works properly:
if (WaitTimer <= diff)
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index ae4b6197f4c..4ef91b93b43 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -121,7 +121,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (HellfireTimer)
{
@@ -386,7 +386,7 @@ public:
Talk(SAY_SUMMON);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
index 5bd9e8a0bae..2a349297860 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -217,7 +217,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -531,7 +531,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
index 75a8c8cf662..fe773a1e3a2 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -111,7 +111,7 @@ public:
} else ERROR_INST_DATA(me);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -228,7 +228,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -362,7 +362,7 @@ public:
instance->SetData(TYPE_TERESTIAN, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 6cb4e70ee7a..06389fbbf25 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -187,7 +187,7 @@ public:
ScriptedAI::MoveInLineOfSight(who);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (AggroTimer)
{
@@ -263,7 +263,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -373,7 +373,7 @@ public:
Talk(SAY_STRAWMAN_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (AggroTimer)
{
@@ -478,7 +478,7 @@ public:
Talk(SAY_TINHEAD_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (AggroTimer)
{
@@ -585,7 +585,7 @@ public:
Talk(SAY_ROAR_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (AggroTimer)
{
@@ -682,7 +682,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -735,7 +735,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->HasAura(SPELL_KNOCKBACK))
DoCast(me, SPELL_KNOCKBACK, true);
@@ -871,7 +871,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1121,7 +1121,7 @@ public:
Talk(SAY_JULIANNE_SLAY);
}
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
};
};
@@ -1276,7 +1276,7 @@ public:
Talk(SAY_ROMULO_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || IsFakingDeath)
return;
@@ -1331,7 +1331,7 @@ public:
};
};
-void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff)
+void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
{
if (EntryYellTimer)
{
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index 7d3b63acb6a..b8525dd0181 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -266,7 +266,7 @@ public:
RaidWiped = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
@@ -613,7 +613,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (YellTimer <= diff)
{
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 5d132cbd34e..699793402f0 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -280,7 +280,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -462,7 +462,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (FlameStrikeTimer <= diff)
{
@@ -548,7 +548,7 @@ public:
me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg.
if (FakeDeath)
@@ -610,7 +610,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (HatchTimer <= diff)
{
@@ -651,7 +651,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (DespawnTimer <= diff)
me->Kill(me);
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 3ed4c50fab4..36324e6b042 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -238,7 +238,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -456,7 +456,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UsedPotion && HealthBelowPct(25))
{
@@ -517,7 +517,7 @@ public:
boss_priestess_lackey_commonAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -623,7 +623,7 @@ public:
DoCast(me, SPELL_SUMMON_IMP);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -703,7 +703,7 @@ public:
boss_priestess_lackey_commonAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -780,7 +780,7 @@ public:
boss_priestess_lackey_commonAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -907,7 +907,7 @@ public:
DoCast(me, SPELL_BATTLE_SHOUT);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1036,7 +1036,7 @@ public:
m_uiPetGUID = summoned->GetGUID();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1144,7 +1144,7 @@ public:
boss_priestess_lackey_commonAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1240,7 +1240,7 @@ public:
boss_priestess_lackey_commonAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
index a18dbe79d40..bd5f57f8af0 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
@@ -242,7 +242,7 @@ public:
ShatterRemainingCrystals();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -338,7 +338,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
void JustDied(Unit* /*killer*/)
{
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
index 85a113ec495..8958246f1cf 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
@@ -127,7 +127,7 @@ public:
summoned->CastSpell(summoned, SPELL_ENERGY_BOLT, false, 0, 0, me->GetGUID());
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
index da1423ed0e9..daaa7d94d18 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
@@ -154,7 +154,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (m_uiTransformTimer)
{
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp
index cc8f2b41fbb..645322768e3 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp
@@ -67,7 +67,7 @@ class boss_baron_geddon : public CreatureScript
events.ScheduleEvent(EVENT_LIVING_BOMB, 35000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp
index 824fcca4714..aa563bf3180 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp
@@ -64,7 +64,7 @@ class boss_garr : public CreatureScript
events.ScheduleEvent(EVENT_MAGMA_SHACKLES, 15000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -129,7 +129,7 @@ class mob_firesworn : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp
index 6e9d9b00523..9007d16d2f9 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp
@@ -61,7 +61,7 @@ class boss_gehennas : public CreatureScript
events.ScheduleEvent(EVENT_SHADOW_BOLT, 6000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
index 65c82610cc2..a21ca66543e 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
@@ -84,7 +84,7 @@ class boss_golemagg : public CreatureScript
events.ScheduleEvent(EVENT_EARTHQUAKE, 3000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -155,7 +155,7 @@ class mob_core_rager : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp
index 1bb93b2e038..cb91cfc3cae 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp
@@ -61,7 +61,7 @@ class boss_lucifron : public CreatureScript
events.ScheduleEvent(EVENT_SHADOW_SHOCK, 6000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp
index c18e9db1ab7..c4b338d635d 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp
@@ -73,7 +73,7 @@ class boss_magmadar : public CreatureScript
events.ScheduleEvent(EVENT_LAVA_BOMB, 12000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp
index 26788e10302..a221e2829dd 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp
@@ -94,7 +94,7 @@ class boss_majordomo : public CreatureScript
events.ScheduleEvent(EVENT_TELEPORT, 20000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance && instance->GetBossState(BOSS_MAJORDOMO_EXECUTUS) != DONE)
{
@@ -174,7 +174,7 @@ class boss_majordomo : public CreatureScript
}
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
if (action == ACTION_START_RAGNAROS)
{
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
index eecd9ae65f4..63764b5de01 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
@@ -115,7 +115,7 @@ class boss_ragnaros : public CreatureScript
Talk(SAY_KILL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_introState != 2)
{
@@ -328,7 +328,7 @@ class mob_son_of_flame : public CreatureScript
instance->SetData(DATA_RAGNAROS_ADDS, 1);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp
index 778a8012269..435082b5a98 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp
@@ -66,7 +66,7 @@ class boss_shazzrah : public CreatureScript
events.ScheduleEvent(EVENT_BLINK, 30000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp
index 1ad0c5dfa2d..b4c2372a015 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp
@@ -77,7 +77,7 @@ class boss_sulfuron : public CreatureScript
events.ScheduleEvent(EVENT_FLAMESPEAR, 2000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -162,7 +162,7 @@ class mob_flamewaker_priest : public CreatureScript
events.ScheduleEvent(EVENT_IMMOLATE, 8000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 96293c635d6..c9d3201d02c 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -102,10 +102,8 @@ public:
npc_unworthy_initiateAI(Creature* creature) : ScriptedAI(creature)
{
me->SetReactState(REACT_PASSIVE);
- if (!me->GetEquipmentId())
- if (const CreatureTemplate* info = sObjectMgr->GetCreatureTemplate(28406))
- if (info->equipmentId)
- const_cast<CreatureTemplate*>(me->GetCreatureTemplate())->equipmentId = info->equipmentId;
+ if (!me->GetCurrentEquipmentId())
+ me->SetCurrentEquipmentId(me->GetOriginalEquipmentId());
}
uint64 playerGUID;
@@ -168,7 +166,7 @@ public:
Talk(SAY_EVENT_START);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
switch (phase)
{
@@ -459,7 +457,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
{
@@ -544,7 +542,7 @@ public:
TargetGUID = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Intro || !TargetGUID)
return;
@@ -816,7 +814,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!me->isInCombat())
{
@@ -890,7 +888,7 @@ public:
minerGUID = guid;
}
- void DoAction(const int32 /*param*/)
+ void DoAction(int32 /*param*/)
{
if (Creature* miner = Unit::GetCreature(*me, minerGUID))
{
@@ -1024,7 +1022,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IntroPhase)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index 6985ad2c4ad..cb067fccf0d 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -90,7 +90,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (speechCounter)
{
@@ -160,7 +160,7 @@ public:
## npc_koltira_deathweaver
######*/
-enum eKoltira
+enum Koltira
{
SAY_BREAKOUT1 = 0,
SAY_BREAKOUT2 = 1,
@@ -180,10 +180,9 @@ enum eKoltira
NPC_CRIMSON_ACOLYTE = 29007,
NPC_HIGH_INQUISITOR_VALROTH = 29001,
- NPC_KOLTIRA_ALT = 28447,
//not sure about this id
- //NPC_DEATH_KNIGHT_MOUNT = 29201,
+ //NPC_DEATH_KNIGHT_MOUNT = 29201,
MODEL_DEATH_KNIGHT_MOUNT = 25278
};
@@ -198,17 +197,12 @@ public:
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
- if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaver::npc_koltira_deathweaverAI, creature->AI()))
- pEscortAI->Start(false, false, player->GetGUID());
+ if (npc_escortAI* escortAI = CAST_AI(npc_koltira_deathweaver::npc_koltira_deathweaverAI, creature->AI()))
+ escortAI->Start(false, false, player->GetGUID());
}
return true;
}
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_koltira_deathweaverAI(creature);
- }
-
struct npc_koltira_deathweaverAI : public npc_escortAI
{
npc_koltira_deathweaverAI(Creature* creature) : npc_escortAI(creature)
@@ -216,20 +210,17 @@ public:
me->SetReactState(REACT_DEFENSIVE);
}
- uint32 m_uiWave;
- uint32 m_uiWave_Timer;
- uint64 m_uiValrothGUID;
-
void Reset()
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
{
- m_uiWave = 0;
- m_uiWave_Timer = 3000;
- m_uiValrothGUID = 0;
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ wave = 0;
+ waveTimer = 3000;
+ valrothGUID = 0;
me->LoadEquipment(0, true);
- me->RemoveAura(SPELL_ANTI_MAGIC_ZONE);
+ me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE);
+ me->RemoveAurasDueToSpell(SPELL_KOLTIRA_TRANSFORM);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
}
@@ -239,22 +230,21 @@ public:
{
case 0:
Talk(SAY_BREAKOUT1);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
break;
case 1:
me->SetStandState(UNIT_STAND_STATE_KNEEL);
break;
case 2:
me->SetStandState(UNIT_STAND_STATE_STAND);
- //me->UpdateEntry(NPC_KOLTIRA_ALT); //unclear if we must update or not
DoCast(me, SPELL_KOLTIRA_TRANSFORM);
- me->LoadEquipment(me->GetEquipmentId());
+ me->LoadEquipment();
break;
case 3:
SetEscortPaused(true);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
Talk(SAY_BREAKOUT2);
- DoCast(me, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up
+ DoCast(me, SPELL_ANTI_MAGIC_ZONE);
break;
case 4:
SetRun(true);
@@ -274,9 +264,8 @@ public:
summoned->AI()->AttackStart(player);
if (summoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH)
- m_uiValrothGUID = summoned->GetGUID();
+ valrothGUID = summoned->GetGUID();
- summoned->AddThreat(me, 0.0f);
summoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
}
@@ -286,57 +275,57 @@ public:
me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329f, -6045.818f, 127.583f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
if (HasEscortState(STATE_ESCORT_PAUSED))
{
- if (m_uiWave_Timer <= uiDiff)
+ if (waveTimer <= uiDiff)
{
- switch (m_uiWave)
+ switch (wave)
{
case 0:
Talk(SAY_BREAKOUT3);
SummonAcolyte(3);
- m_uiWave_Timer = 20000;
+ waveTimer = 20000;
break;
case 1:
Talk(SAY_BREAKOUT4);
SummonAcolyte(3);
- m_uiWave_Timer = 20000;
+ waveTimer = 20000;
break;
case 2:
Talk(SAY_BREAKOUT5);
SummonAcolyte(4);
- m_uiWave_Timer = 20000;
+ waveTimer = 20000;
break;
case 3:
Talk(SAY_BREAKOUT6);
me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329f, -6045.818f, 127.583f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
- m_uiWave_Timer = 1000;
+ waveTimer = 1000;
break;
case 4:
{
- Creature* temp = Unit::GetCreature(*me, m_uiValrothGUID);
+ Creature* temp = Unit::GetCreature(*me, valrothGUID);
if (!temp || !temp->isAlive())
{
Talk(SAY_BREAKOUT8);
- m_uiWave_Timer = 5000;
+ waveTimer = 5000;
}
else
{
- m_uiWave_Timer = 2500;
- return; //return, we don't want m_uiWave to increment now
+ waveTimer = 2500;
+ return;
}
break;
}
case 5:
Talk(SAY_BREAKOUT9);
me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE);
- // i do not know why the armor will also be removed
- m_uiWave_Timer = 2500;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ waveTimer = 2500;
break;
case 6:
Talk(SAY_BREAKOUT10);
@@ -344,14 +333,24 @@ public:
break;
}
- ++m_uiWave;
+ ++wave;
}
else
- m_uiWave_Timer -= uiDiff;
+ waveTimer -= uiDiff;
}
}
+
+ private:
+ uint8 wave;
+ uint32 waveTimer;
+ uint64 valrothGUID;
+
};
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_koltira_deathweaverAI(creature);
+ }
};
//Scarlet courier
@@ -404,7 +403,7 @@ public:
uiStage = 2;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiStage && !me->isInCombat())
{
@@ -487,7 +486,7 @@ public:
DoCast(who, SPELL_VALROTH_SMITE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiRenew_timer <= diff)
{
@@ -677,7 +676,7 @@ public:
PlayerGUID = who->GetGUID();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (PlayerGUID && !me->getVictim() && me->isAlive())
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index ff92710d5b2..3d91e81644e 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -606,7 +606,7 @@ public:
npc_escortAI::EnterEvadeMode();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
@@ -1662,7 +1662,7 @@ public:
npc_the_lich_king_tirion_dawnAI(Creature* creature) : ScriptedAI(creature) { Reset(); }
void Reset() {}
void AttackStart(Unit* /*who*/) {} // very sample, just don't make them aggreesive
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
void JustDied(Unit* /*killer*/) {}
};
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
index 27e057ce6aa..16e6554d1f4 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp
@@ -69,7 +69,7 @@ public:
me->SetPosition(x, y, z, 0.0f);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (FlyBackTimer <= diff)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
index 1ede8a871d9..db08df50148 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
@@ -72,7 +72,7 @@ public:
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
index 23480154c22..384ffeb6bf3 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
@@ -60,7 +60,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
index 7540a1eefb3..cae033f2a30 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
@@ -77,7 +77,7 @@ public:
Talk(SAY_KILL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 4927666073b..32e8af3821b 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -204,7 +204,7 @@ public:
DoCast(who, SPELL_SQUASH_SOUL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (delay)
{
@@ -325,7 +325,7 @@ public:
}
void Disappear();
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!withbody)
{
@@ -639,7 +639,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (withhead)
{
@@ -858,7 +858,7 @@ public:
DoStartMovement(who);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (sprouted && UpdateVictim())
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
index 6e24dd81bbe..4929e0fbb3d 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
@@ -93,7 +93,7 @@ public:
me->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18f, -431.58f, 17.09f, 6.22f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -152,7 +152,7 @@ public:
void WaypointReached(uint32 /*waypointId*/) {}
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Start_Timer)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
index 2c64ba693d0..12148157062 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
@@ -77,7 +77,7 @@ public:
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
index 1b2679538b0..6bdf1a16b03 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
@@ -59,7 +59,7 @@ public:
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
index 76673b7a632..4206e958f3c 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
@@ -89,7 +89,7 @@ public:
vorrel->AI()->Talk(SAY_TRIGGER_VORREL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
index 70af355a4c7..c6fdc6e651b 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -175,7 +175,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -290,7 +290,7 @@ public:
damage = me->GetHealth() - 1;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
index f6b6118f701..639db4571cb 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
@@ -63,7 +63,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
index 5d164fbfafa..dccb7ccbaa0 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
@@ -88,7 +88,7 @@ class boss_darkmaster_gandling : public CreatureScript
me->GetMotionMaster()->MoveRandom(5);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
index b2a91f4efe4..0f1999b112f 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
@@ -61,7 +61,7 @@ class boss_doctor_theolen_krastinov : public CreatureScript
events.ScheduleEvent(EVENT_FRENZY, 1000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
index 617dff17220..5ea6c86d23e 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
@@ -59,7 +59,7 @@ class boss_illucia_barov : public CreatureScript
events.ScheduleEvent(EVENT_FEAR, 30000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
index e2c7287f178..1d311a7bd2c 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
@@ -72,7 +72,7 @@ class boss_instructor_malicia : public CreatureScript
events.ScheduleEvent(EVENT_HEALINGTOUCH, 45000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
index c9cf4aa9020..3f083a30987 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
@@ -70,7 +70,7 @@ public:
Illusion->AI()->AttackStart(victim);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Invisible && Invisible_Timer <= diff)
{
@@ -180,7 +180,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 19660cec4af..97b8e0334ee 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp
@@ -142,7 +142,7 @@ class boss_kirtonos_the_herald : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
index a0dc31c4dff..1167a945992 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
@@ -74,7 +74,7 @@ public:
SummonedMage->AI()->AttackStart(victim);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
index 3a7aee0d6c6..d0028894067 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
@@ -59,7 +59,7 @@ class boss_lord_alexei_barov : public CreatureScript
events.ScheduleEvent(EVENT_VEILOFSHADOW, 15000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
index d06189d5054..f7170a0618f 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
@@ -59,7 +59,7 @@ class boss_lorekeeper_polkelt : public CreatureScript
events.ScheduleEvent(EVENT_NOXIOUSCATALYST, 35000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
index 99f01ee96c3..4483d5332d7 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
@@ -71,7 +71,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
index 99b9fba958c..14caccb8b00 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
@@ -59,7 +59,7 @@ class boss_the_ravenian : public CreatureScript
events.ScheduleEvent(EVENT_KNOCKAWAY, 32000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
index 054760981d2..85ae16499cf 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
@@ -60,7 +60,7 @@ public:
m_uiFrenzy_Timer = 0;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index f9bd7d89216..7af7e1e78bc 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
@@ -172,7 +172,7 @@ public:
uiDarkOffering = urand(200, 1000);
}
- void UpdateAI(uint32 const uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
index 2357f59b65d..8b49df5ca84 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
@@ -116,7 +116,7 @@ public:
instance->SetData(TYPE_BARON, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
index d72e226d2e2..b2adbecbe63 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
@@ -74,7 +74,7 @@ public:
instance->SetData(TYPE_BARONESS, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
index 909609baecc..74819269415 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
@@ -119,7 +119,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
index 2cb00df38db..f75a0c4a3dc 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
@@ -120,7 +120,7 @@ public:
{
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
index 5d75ce4fa16..5f4d1cbc0b9 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
@@ -85,7 +85,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
index 0a7bdfad583..2812c1dd39b 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
@@ -72,7 +72,7 @@ public:
instance->SetData(TYPE_PALLID, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
index 75bdd2b06de..2cc16bc2972 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
@@ -84,7 +84,7 @@ public:
pUndeadScarab->AI()->AttackStart(victim);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
index e52fd3402e7..7c6ea86dfa5 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp
@@ -136,7 +136,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
index 5b0b39c1de2..3d0eaba9022 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
@@ -77,7 +77,7 @@ class boss_postmaster_malown : public CreatureScript
Talk(SAY_KILL);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
index 6d83093d13c..5cd69f561d6 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
@@ -82,7 +82,7 @@ public:
instance->SetData(TYPE_RAMSTEIN, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
index bd7c3519926..27249e84892 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
@@ -68,7 +68,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 0798fe2e3b0..7208bbbee03 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -172,7 +172,7 @@ public:
me->SummonCreature(ENTRY_FREED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 300000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Tagged)
{
@@ -244,7 +244,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Tagged)
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index dab612828f8..d81c001889a 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -277,7 +277,7 @@ public:
ScriptedAI::MoveInLineOfSight(who);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsIntro)
{
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
index c186ada72b7..eb2e4f1ae8b 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -217,7 +217,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!SisterDeath)
{
@@ -345,10 +345,12 @@ public:
return new boss_alythessAI (creature);
};
- struct boss_alythessAI : public Scripted_NoMovementAI
+ struct boss_alythessAI : public ScriptedAI
{
- boss_alythessAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ boss_alythessAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
+
instance = creature->GetInstanceScript();
IntroStepCounter = 10;
}
@@ -418,9 +420,7 @@ public:
void AttackStart(Unit* who)
{
if (!me->isInCombat())
- {
- Scripted_NoMovementAI::AttackStart(who);
- }
+ ScriptedAI::AttackStart(who);
}
void MoveInLineOfSight(Unit* who)
@@ -542,7 +542,7 @@ public:
return 10000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IntroStepCounter < 9)
{
@@ -707,7 +707,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->HasAura(SPELL_IMAGE_VISUAL))
DoCast(me, SPELL_IMAGE_VISUAL);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index 7f72da805ce..6ac6b9a4812 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -404,7 +404,7 @@ public:
++uiFlightCount;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
{
@@ -536,7 +536,7 @@ public:
DoZoneInCombat();
//DoCast(me, SPELL_VAPOR_FORCE, true); core bug
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!me->getVictim())
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
@@ -568,7 +568,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
};
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index a8755c16418..f6c9b79bbc1 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -182,7 +182,7 @@ public:
ScriptedAI::EnterEvadeMode();
}
- void DoAction(const int32 param)
+ void DoAction(int32 param)
{
switch (param)
{
@@ -197,7 +197,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (TalkTimer)
{
@@ -485,7 +485,7 @@ public:
damage *= 3;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true);
@@ -691,7 +691,7 @@ public:
}
}
- void DoAction(const int32 param)
+ void DoAction(int32 param)
{
switch (param)
{
@@ -706,7 +706,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true);
@@ -780,8 +780,9 @@ public:
if (AgonyCurseTimer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (!target) target = me->getVictim();
+ Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
+ if (!target)
+ target = me->getVictim();
DoCast(target, SPELL_AGONY_CURSE);
AgonyCurseTimer = 20000;
} else AgonyCurseTimer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 59face32389..39adb8faeff 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -335,7 +335,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
}
@@ -392,11 +392,13 @@ public:
return new mob_kiljaeden_controllerAI (creature);
}
- struct mob_kiljaeden_controllerAI : public Scripted_NoMovementAI
+ struct mob_kiljaeden_controllerAI : public ScriptedAI
{
- mob_kiljaeden_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature), summons(me)
+ mob_kiljaeden_controllerAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
instance = creature->GetInstanceScript();
+
+ SetCombatMovement(false);
}
InstanceScript* instance;
@@ -452,7 +454,7 @@ public:
summons.Summon(summoned);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiRandomSayTimer < diff)
{
@@ -492,11 +494,13 @@ public:
return new boss_kiljaedenAI (creature);
}
- struct boss_kiljaedenAI : public Scripted_NoMovementAI
+ struct boss_kiljaedenAI : public ScriptedAI
{
- boss_kiljaedenAI(Creature* creature) : Scripted_NoMovementAI(creature), summons(me)
+ boss_kiljaedenAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
instance = creature->GetInstanceScript();
+
+ SetCombatMovement(false);
}
InstanceScript* instance;
@@ -520,7 +524,7 @@ public:
void InitializeAI()
{
- Scripted_NoMovementAI::InitializeAI();
+ // Scripted_NoMovementAI::InitializeAI();
}
void Reset()
@@ -615,7 +619,8 @@ public:
void EnterEvadeMode()
{
- Scripted_NoMovementAI::EnterEvadeMode();
+ ScriptedAI::EnterEvadeMode();
+
summons.DespawnAll();
// Reset the controller
@@ -661,7 +666,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || Phase < PHASE_NORMAL)
return;
@@ -946,7 +951,7 @@ public:
++(CAST_AI(mob_kiljaeden_controller::mob_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat())
DoCast(me, SPELL_SHADOW_CHANNELING);
@@ -999,9 +1004,12 @@ public:
return new mob_felfire_portalAI (creature);
}
- struct mob_felfire_portalAI : public Scripted_NoMovementAI
+ struct mob_felfire_portalAI : public ScriptedAI
{
- mob_felfire_portalAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ mob_felfire_portalAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
uint32 uiSpawnFiendTimer;
@@ -1017,7 +1025,7 @@ public:
summoned->SetLevel(me->getLevel());
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1063,7 +1071,7 @@ public:
DoCast(me, SPELL_FELFIRE_FISSION, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1100,9 +1108,12 @@ public:
return new mob_armageddonAI (creature);
}
- struct mob_armageddonAI : public Scripted_NoMovementAI
+ struct mob_armageddonAI : public ScriptedAI
{
- mob_armageddonAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ mob_armageddonAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
uint8 spell;
uint32 uiTimer;
@@ -1113,7 +1124,7 @@ public:
uiTimer = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiTimer <= diff)
{
@@ -1182,7 +1193,7 @@ public:
bClockwise = urand(0, 1);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (bPointReached)
{
@@ -1256,7 +1267,7 @@ public:
victimClass = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index 5eb79258005..aa4acc24bfd 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -172,7 +172,7 @@ public:
instance->SetData(DATA_MURU_EVENT, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -213,10 +213,11 @@ public:
return new boss_muruAI (creature);
}
- struct boss_muruAI : public Scripted_NoMovementAI
+ struct boss_muruAI : public ScriptedAI
{
- boss_muruAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me)
+ boss_muruAI(Creature* creature) : ScriptedAI(creature), Summons(creature)
{
+ SetCombatMovement(false);
instance = creature->GetInstanceScript();
}
@@ -285,7 +286,7 @@ public:
Summons.Summon(summoned);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -377,10 +378,11 @@ public:
return new npc_muru_portalAI (creature);
}
- struct npc_muru_portalAI : public Scripted_NoMovementAI
+ struct npc_muru_portalAI : public ScriptedAI
{
- npc_muru_portalAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me)
+ npc_muru_portalAI(Creature* creature) : ScriptedAI(creature), Summons(creature)
{
+ SetCombatMovement(false);
instance = creature->GetInstanceScript();
}
@@ -432,7 +434,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!SummonSentinel)
{
@@ -482,7 +484,7 @@ public:
me->DisappearAndDie();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -544,7 +546,7 @@ public:
me->SummonCreature(CREATURE_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -600,7 +602,7 @@ public:
DoCastAOE(SPELL_BLACKHOLE_SPAWN, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (SpellTimer <= diff)
{
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index 81f64ce6de0..ec9409af69f 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -130,7 +130,7 @@ class boss_archaedas : public CreatureScript
Talk(SAY_KILL);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!instance)
return;
@@ -278,7 +278,7 @@ class mob_archaedas_minions : public CreatureScript
ScriptedAI::MoveInLineOfSight(who);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
// we're still in the awaken animation
if (bWakingUp && iAwakenTimer >= 0)
@@ -347,7 +347,7 @@ class mob_stonekeepers : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
index 6f521060541..f40570d4130 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
@@ -63,7 +63,7 @@ class boss_ironaya : public CreatureScript
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
index 0cd59951590..9fdc2f26d9f 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
@@ -68,7 +68,7 @@ class mob_jadespine_basilisk : public CreatureScript
{
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index 1b2512ccf63..ce526fb0ddc 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -201,8 +201,11 @@ class boss_akilzon : public CreatureScript
//dealdamege
for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i)
{
- if (!Cloud->IsWithinDist(*i, 6, false))
- Cloud->CastCustomSpell(*i, 43137, &bp0, NULL, NULL, true, 0, 0, me->GetGUID());
+ if (Unit* target = (*i))
+ {
+ if (!Cloud->IsWithinDist(target, 6, false))
+ Cloud->CastCustomSpell(target, 43137, &bp0, NULL, NULL, true, 0, 0, me->GetGUID());
+ }
}
// visual
float x, y, z;
@@ -237,7 +240,7 @@ class boss_akilzon : public CreatureScript
StormSequenceTimer = 1000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -418,7 +421,7 @@ class mob_akilzon_eagle : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (EagleSwoop_Timer <= diff)
EagleSwoop_Timer = 0;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
index 577423adb39..21392fda660 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
@@ -213,7 +213,7 @@ class boss_halazzi : public CreatureScript
Phase = NextPhase;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -384,7 +384,7 @@ class mob_halazzi_lynx : public CreatureScript
void EnterCombat(Unit* /*who*/) {/*DoZoneInCombat();*/}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
index d3d7bd390ca..332baa29b51 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
@@ -198,7 +198,7 @@ struct boss_hexlord_addAI : public ScriptedAI
DoZoneInCombat();
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (instance && instance->GetData(DATA_HEXLORDEVENT) != IN_PROGRESS)
{
@@ -351,7 +351,7 @@ class boss_hexlord_malacrass : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -511,7 +511,7 @@ class boss_thurg : public CreatureScript
boss_hexlord_addAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -588,7 +588,7 @@ class boss_alyson_antille : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -672,7 +672,7 @@ struct boss_gazakrothAI : public boss_hexlord_addAI
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -714,7 +714,7 @@ class boss_lord_raadan : public CreatureScript
boss_hexlord_addAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -763,7 +763,7 @@ class boss_darkheart : public CreatureScript
psychicwail_timer = 8000;
boss_hexlord_addAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -822,7 +822,7 @@ class boss_slither : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -867,7 +867,7 @@ class boss_fenstalker : public CreatureScript
boss_hexlord_addAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -916,7 +916,7 @@ class boss_koragg : public CreatureScript
boss_hexlord_addAI::Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
index eced8dd6830..75e044a3c5e 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
@@ -315,7 +315,7 @@ class boss_janalai : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (isFlameBreathing)
{
@@ -468,7 +468,7 @@ class mob_janalai_firebomb : public CreatureScript
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
CreatureAI* GetAI(Creature* creature) const
@@ -560,7 +560,7 @@ class mob_janalai_hatcher : public CreatureScript
WaitTimer = 1;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance || !(instance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS))
{
@@ -641,7 +641,7 @@ class mob_janalai_hatchling : public CreatureScript
void EnterCombat(Unit* /*who*/) {/*DoZoneInCombat();*/}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance || !(instance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS))
{
@@ -684,7 +684,7 @@ public:
void Reset() {}
- void UpdateAI(uint32 const /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
index 8fd9da930ae..e1cbb52e8d9 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
@@ -343,7 +343,7 @@ class boss_nalorakk : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (waitTimer && inMove)
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 2305c360fd2..be88e67386b 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -363,7 +363,7 @@ class boss_zuljin : public CreatureScript
Phase = NextPhase;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!TankGUID)
{
@@ -582,7 +582,7 @@ class mob_zuljin_vortex : public CreatureScript
DoCast(caster, SPELL_ZAP_DAMAGE, true);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
//if the vortex reach the target, it change his target to another player
if (me->IsWithinMeleeRange(me->getVictim()))
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
index 44fa0f87177..ff6d434fa40 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
@@ -148,7 +148,7 @@ class npc_zulaman_hostage : public CreatureScript
player->SendLoot(me->GetGUID(), LOOT_CORPSE);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (IsLoot)
DoCast(me, 7, false);
@@ -314,14 +314,14 @@ class npc_harrison_jones : public CreatureScript
me->SetEntry(NPC_HARRISON_JONES_2);
me->SetDisplayId(MODEL_HARRISON_JONES_2);
me->SetTarget(0);
- me->SetByteValue(UNIT_FIELD_BYTES_1, 0,UNIT_STAND_STATE_DEAD);
+ me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_DEAD);
me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
if (instance)
instance->SetData(DATA_GONGEVENT, DONE);
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (_gongEvent)
{
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
index c2806c395f4..97eeb385e15 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
@@ -180,7 +180,7 @@ class boss_arlokk : public CreatureScript
--_summonCountB;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -386,7 +386,7 @@ class npc_zulian_prowler : public CreatureScript
me->DespawnOrUnsummon(4000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (UpdateVictim())
{
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
index f3f12bc35c5..e930d864940 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
@@ -67,7 +67,7 @@ class boss_gahzranka : public CreatureScript // gahzranka
events.ScheduleEvent(EVENT_SLAM, 17000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
index f06500694a5..af8303e63e4 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
@@ -64,7 +64,7 @@ class boss_grilek : public CreatureScript // grilek
events.ScheduleEvent(EVENT_GROUND_TREMOR, urand(15000, 25000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -80,8 +80,12 @@ class boss_grilek : public CreatureScript // grilek
{
case EVENT_AVATAR:
DoCast(me, SPELL_AVATAR);
- if (DoGetThreat(me->getVictim()))
- DoModifyThreatPercent(me->getVictim(), -50);
+ if (Unit* victim = me->getVictim())
+ {
+ if (DoGetThreat(victim))
+ DoModifyThreatPercent(victim, -50);
+ }
+
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
AttackStart(target);
events.ScheduleEvent(EVENT_AVATAR, urand(25000, 35000));
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
index 68aac7547df..f9fe338d918 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
@@ -103,7 +103,7 @@ class boss_hakkar : public CreatureScript
Talk(SAY_AGGRO);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
index 809403bb325..b2282ba85da 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
@@ -66,7 +66,7 @@ class boss_hazzarah : public CreatureScript
events.ScheduleEvent(EVENT_ILLUSIONS, urand(10000, 18000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
index dc02c895327..73d2982aee6 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
@@ -97,7 +97,7 @@ class boss_jeklik : public CreatureScript //jeklik
DoCast(me, SPELL_BAT_FORM);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -158,7 +158,7 @@ class boss_jeklik : public CreatureScript //jeklik
{
if (PhaseTwo)
{
- if (PhaseTwo && ShadowWordPain_Timer <= diff)
+ if (ShadowWordPain_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
@@ -189,13 +189,11 @@ class boss_jeklik : public CreatureScript //jeklik
if (SpawnFlyingBats_Timer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (!target)
- return;
-
- Creature* FlyingBat = me->SummonCreature(14965, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- if (FlyingBat)
- FlyingBat->AI()->AttackStart(target);
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ {
+ if (Creature* FlyingBat = me->SummonCreature(14965, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
+ FlyingBat->AI()->AttackStart(target);
+ }
SpawnFlyingBats_Timer = urand(10000, 15000);
} else SpawnFlyingBats_Timer -=diff;
@@ -251,7 +249,7 @@ class mob_batrider : public CreatureScript
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
index 005609e88db..166acc13f58 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
@@ -86,7 +86,7 @@ class boss_jindo : public CreatureScript
Talk(SAY_AGGRO);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -110,9 +110,12 @@ class boss_jindo : public CreatureScript
events.ScheduleEvent(EVENT_POWERFULLHEALINGWARD, urand(14000, 20000));
break;
case EVENT_HEX:
- DoCastVictim(SPELL_HEX, true);
- if (DoGetThreat(me->getVictim()))
- DoModifyThreatPercent(me->getVictim(), -80);
+ if (Unit* target = me->getVictim())
+ {
+ DoCast(target, SPELL_HEX, true);
+ if (DoGetThreat(target))
+ DoModifyThreatPercent(target, -80);
+ }
events.ScheduleEvent(EVENT_HEX, urand(12000, 20000));
break;
case EVENT_DELUSIONSOFJINDO: // HACK
@@ -161,7 +164,7 @@ class boss_jindo : public CreatureScript
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
- }
+ }
events.ScheduleEvent(EVENT_TELEPORT, urand(15000, 23000));
break;
default:
@@ -209,7 +212,7 @@ class mob_healing_ward : public CreatureScript
{
}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Heal_Timer
if (Heal_Timer <= diff)
@@ -257,7 +260,7 @@ class mob_shade_of_jindo : public CreatureScript
void EnterCombat(Unit* /*who*/){}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//ShadowShock_Timer
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index e402480609b..bd7b7a8798c 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -191,7 +191,7 @@ class boss_mandokir : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
@@ -311,7 +311,7 @@ class mob_ohgan : public CreatureScript
instance->SetBossState(DATA_OHGAN, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// Return since we have no target
if (!UpdateVictim())
@@ -364,7 +364,7 @@ class mob_vilebranch_speaker : public CreatureScript
instance->SetBossState(DATA_MANDOKIR, SPECIAL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
index 40850a988e4..b1200c2899e 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
@@ -95,7 +95,7 @@ class boss_marli : public CreatureScript
Talk(SAY_AGGRO);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -239,7 +239,7 @@ class mob_spawn_of_marli : public CreatureScript
{
}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
index 6bf87decf7e..7e8c7dca7b4 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
@@ -78,7 +78,7 @@ class boss_renataki : public CreatureScript
_EnterCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
index 61eb695719a..f115daf0fb0 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
@@ -116,7 +116,7 @@ class boss_thekal : public CreatureScript
instance->SetBossState(DATA_THEKAL, NOT_STARTED);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -232,7 +232,7 @@ class boss_thekal : public CreatureScript
if (me->IsFullHealth() && WasDead)
WasDead = false;
- if ((events.GetPhaseMask() == PHASE_ONE) && !WasDead && !HealthAbovePct(5))
+ if ((events.IsInPhase(PHASE_ONE)) && !WasDead && !HealthAbovePct(5))
{
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
@@ -298,7 +298,7 @@ class mob_zealot_lorkhan : public CreatureScript
{
}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -460,7 +460,7 @@ class mob_zealot_zath : public CreatureScript
{
}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
index 11a6e710c3c..3d53d71394b 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
@@ -147,7 +147,7 @@ class boss_venoxis : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
index d1e7edf0218..945303f3d10 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
@@ -64,7 +64,7 @@ class boss_wushoolay : public CreatureScript
events.ScheduleEvent(EVENT_LIGHTNINGWAVE, urand(8000, 16000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp
index 158861e90c7..997417714e8 100644
--- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp
+++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp
@@ -86,7 +86,7 @@ public:
Hound->AI()->AttackStart(victim);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
index d638a435936..74344f28a9b 100644
--- a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
@@ -115,7 +115,7 @@ class npc_professor_phizzlethorpe : public CreatureScript
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
diff --git a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp
index 1ce83d31a63..5bfb5edadc1 100644
--- a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp
@@ -116,7 +116,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp
index 432768a51de..ce62de8b368 100644
--- a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp
@@ -166,7 +166,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (questPhase == 1)
{
@@ -315,7 +315,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// Quest accepted but object not activated, object despawned (if in sync 1 minute!)
if (questPhase == 1)
@@ -496,7 +496,7 @@ public:
player->FailQuest(QUEST_UNEXPECTED_RESULT);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (KillCount >= 3 && PlayerGUID)
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
@@ -551,9 +551,12 @@ public:
return new npc_infused_crystalAI (creature);
}
- struct npc_infused_crystalAI : public Scripted_NoMovementAI
+ struct npc_infused_crystalAI : public ScriptedAI
{
- npc_infused_crystalAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ npc_infused_crystalAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
uint32 EndTimer;
uint32 WaveTimer;
@@ -596,7 +599,7 @@ public:
CAST_PLR(player)->FailQuest(QUEST_POWERING_OUR_DEFENSES);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (EndTimer < diff && Progress)
{
diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
index bfd4d24cec6..45f5e17095f 100644
--- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp
@@ -71,7 +71,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Credit)
{
@@ -145,7 +145,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
index 5ff95f83f25..fc5ee94a55f 100644
--- a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
@@ -105,7 +105,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (HasEscortState(STATE_ESCORT_NONE))
return;
diff --git a/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp
index e750faefbf5..fd36a02b8a5 100644
--- a/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp
@@ -77,7 +77,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (me->IsStandState())
{
diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
index 290f7fa6882..80e47dbbf08 100644
--- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
@@ -253,7 +253,7 @@ public:
player->FailQuest(QUEST_PYREWOOD_AMBUSH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//sLog->outInfo(LOG_FILTER_TSCR, "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer);
diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
index e81567a1a7a..b9c9c8ff15b 100644
--- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
@@ -308,7 +308,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiPhase)
{
@@ -448,7 +448,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -524,7 +524,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiPhase)
{
diff --git a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
index 6e14ef840a3..c11e850cbc8 100644
--- a/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stranglethorn_vale.cpp
@@ -83,7 +83,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (bReset)
{
diff --git a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
index f686de5d88f..c7780bb0065 100644
--- a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
@@ -128,7 +128,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
index f36220dec0f..9a496fadb1e 100644
--- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
@@ -113,7 +113,7 @@ public:
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (m_uiPhase)
{
diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
index 2c3017a2f1a..43ee012ef40 100644
--- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
@@ -142,7 +142,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (LamentEvent)
{
@@ -248,7 +248,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (EventMove)
{
diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
index ee22b766154..1831d9f7ff1 100644
--- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp
@@ -254,9 +254,12 @@ public:
return new npc_andorhal_towerAI (creature);
}
- struct npc_andorhal_towerAI : public Scripted_NoMovementAI
+ struct npc_andorhal_towerAI : public ScriptedAI
{
- npc_andorhal_towerAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ npc_andorhal_towerAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
void MoveInLineOfSight(Unit* who)
{
@@ -395,7 +398,7 @@ public:
player->FailQuest(QUEST_TOMB_LIGHTBRINGER);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
index 9d35b510f6e..4541e160e63 100644
--- a/src/server/scripts/Events/childrens_week.cpp
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -173,7 +173,7 @@ class npc_winterfin_playmate : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
@@ -271,7 +271,7 @@ class npc_snowfall_glade_playmate : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
@@ -371,7 +371,7 @@ class npc_the_biggest_tree : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
@@ -457,7 +457,7 @@ class npc_high_oracle_soo_roo : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
@@ -545,7 +545,7 @@ class npc_elder_kekek : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
@@ -633,7 +633,7 @@ class npc_the_etymidian : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
@@ -755,7 +755,7 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp
index f82782448ea..d4e1b8d8ce2 100644
--- a/src/server/scripts/Examples/example_creature.cpp
+++ b/src/server/scripts/Examples/example_creature.cpp
@@ -165,7 +165,7 @@ class example_creature : public CreatureScript
// *** HANDLED FUNCTION ***
//Update AI is called Every single map update (roughly once every 50ms if a player is within the grid)
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Out of combat timers
if (!me->getVictim())
diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp
index a7906c4359a..e911736036c 100644
--- a/src/server/scripts/Examples/example_escort.cpp
+++ b/src/server/scripts/Examples/example_escort.cpp
@@ -136,7 +136,7 @@ class example_escort : public CreatureScript
Talk(SAY_DEATH_3);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Must update npc_escortAI
npc_escortAI::UpdateAI(uiDiff);
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index 27a442f302e..0f52daba991 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -132,7 +132,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
index e3fdc633382..535d9a4425b 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp
@@ -67,7 +67,7 @@ public:
instance->SetData(TYPE_AKU_MAI, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
index ee87dfa3cf8..4fa9edd40c6 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp
@@ -64,7 +64,7 @@ public:
instance->SetData(TYPE_GELIHAST, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
index 61f933d0893..72992c477a8 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
@@ -73,7 +73,7 @@ public:
instance->SetData(TYPE_KELRIS, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/CMakeLists.txt b/src/server/scripts/Kalimdor/CMakeLists.txt
index 5c44cd7ef27..536824e7a63 100644
--- a/src/server/scripts/Kalimdor/CMakeLists.txt
+++ b/src/server/scripts/Kalimdor/CMakeLists.txt
@@ -38,11 +38,11 @@ set(scripts_STAT_SRCS
Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h
Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
- Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
- Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
+ Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp
+ Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp
Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
- Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
+ Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp
Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
index 075d54937c7..6a697c3cc9c 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
@@ -106,7 +106,7 @@ public:
Talk(SAY_ONDEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsEvent)
{
@@ -221,7 +221,7 @@ public:
AttackStart(who);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (CheckTimer <= diff)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
index e278b3009a0..dcf9605f101 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -115,7 +115,7 @@ public:
damage = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (CheckTimer <= diff)
{
@@ -200,7 +200,7 @@ public:
damage = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (ChangeTargetTimer <= diff)
{
@@ -465,7 +465,7 @@ public:
SoulChargeTimer = urand(2000, 30000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat())
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index 180aeb0962d..15470716ea7 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -112,7 +112,7 @@ public:
Talk(SAY_ONDEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsEvent)
{
@@ -234,7 +234,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (CheckTimer <= diff)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index 2432be2c31a..0780b3dcf0d 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -108,7 +108,7 @@ public:
DoPlaySoundToSet(me, SOUND_ONDEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsEvent)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
index 84ef05779ee..b35826c9d87 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
@@ -103,7 +103,7 @@ public:
Talk(SAY_ONDEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsEvent)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index aa17fcf6af4..3f186c96d40 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -708,7 +708,7 @@ void hyjalAI::DeSpawnVeins()
}
}
-void hyjalAI::UpdateAI(const uint32 diff)
+void hyjalAI::UpdateAI(uint32 diff)
{
if (IsDummy)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
index 0833dc2bf07..f40c868a96b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
@@ -153,7 +153,7 @@ struct hyjalAI : public npc_escortAI
void EnterCombat(Unit* /*who*/); // Used to reset cooldowns for our spells and to inform the raid that we're under attack
- void UpdateAI(const uint32 diff); // Called to summon waves, check for boss deaths and to cast our spells.
+ void UpdateAI(uint32 diff); // Called to summon waves, check for boss deaths and to cast our spells.
void JustDied(Unit* /*killer*/); // Called on death, informs the raid that they have failed.
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 36f6f94b324..adb89ba5a69 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -199,7 +199,7 @@ void hyjal_trashAI::DamageTaken(Unit* done_by, uint32 &damage)
}
}
-void hyjal_trashAI::UpdateAI(const uint32 /*diff*/)
+void hyjal_trashAI::UpdateAI(uint32 /*diff*/)
{
if (IsOverrun && !SetupOverrun)
{
@@ -458,7 +458,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Delay <= diff)
{
@@ -596,7 +596,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
@@ -699,7 +699,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
@@ -822,7 +822,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
@@ -920,7 +920,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
@@ -1019,7 +1019,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
@@ -1109,7 +1109,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
@@ -1208,7 +1208,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
@@ -1321,7 +1321,7 @@ public:
hyjal_trashAI::JustDied(killer);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
@@ -1369,8 +1369,7 @@ public:
forcemove = false;
if (forcemove)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
me->Attack(target, false);
}
if (MoveTimer <= diff)
@@ -1409,11 +1408,11 @@ public:
return new alliance_riflemanAI(creature);
}
- struct alliance_riflemanAI : public Scripted_NoMovementAI
+ struct alliance_riflemanAI : public ScriptedAI
{
- alliance_riflemanAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ alliance_riflemanAI(Creature* creature) : ScriptedAI(creature)
{
- Reset();
+ SetCombatMovement(false);
}
uint32 ExplodeTimer;
@@ -1444,7 +1443,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h
index 1a9a4394a3d..01ae6244b4a 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h
@@ -27,7 +27,7 @@ struct hyjal_trashAI : public npc_escortAI
{
hyjal_trashAI(Creature* creature);
- void UpdateAI(const uint32 diff);
+ void UpdateAI(uint32 diff);
void JustDied(Unit* /*killer*/);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp
index fad5736e18f..db568ddc81c 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp
@@ -93,7 +93,7 @@ public:
instance->SetData(DATA_EPOCH_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp
index 8c2861db299..262f8a76509 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite_corruptor.cpp
@@ -64,7 +64,7 @@ public:
instance->SetData(DATA_INFINITE_EVENT, IN_PROGRESS);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
//Return since we have no target
if (!UpdateVictim())
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 5aacaf736e0..09335ffb865 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
@@ -119,7 +119,7 @@ public:
damage = me->GetHealth()-1;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
switch (Phase)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
index c7b819dd243..7cf095d176c 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
@@ -87,7 +87,7 @@ public:
instance->SetData(DATA_MEATHOOK_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp
index d7d9beaedd4..828ffd90113 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp
@@ -96,7 +96,7 @@ public:
instance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 d5d5416f093..d8df5d56888 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -589,7 +589,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
index 7643131edf7..7a18210791c 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
@@ -109,7 +109,7 @@ public:
Talk(SAY_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp
index ea372621026..ef0d7b1f418 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp
@@ -108,7 +108,7 @@ public:
instance->SetData(TYPE_RIFT, SPECIAL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -124,8 +124,8 @@ public:
//Arcane Discharge
if (ArcaneDischarge_Timer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- DoCast(target, SPELL_ARCANE_DISCHARGE);
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ DoCast(target, SPELL_ARCANE_DISCHARGE);
ArcaneDischarge_Timer = 20000+rand()%10000;
} else ArcaneDischarge_Timer -= diff;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
index 6e78e4dae7b..e224094b1f9 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
@@ -108,7 +108,7 @@ public:
ScriptedAI::MoveInLineOfSight(who);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
index 4c80bc017b7..c7c88e380cb 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
@@ -168,7 +168,7 @@ public:
Talk(SAY_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance)
return;
@@ -342,7 +342,7 @@ public:
} else DoSummonAtRift(entry);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance)
return;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
index 9c17ed10d9c..78b655bb73b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
@@ -122,7 +122,7 @@ public:
bool IsEncounterInProgress() const
{
- if (const_cast<instance_dark_portal_InstanceMapScript*>(this)->GetData(TYPE_MEDIVH) == IN_PROGRESS)
+ if (GetData(TYPE_MEDIVH) == IN_PROGRESS)
return true;
return false;
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 5e7fc6e66e8..adbc7a14745 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
@@ -103,7 +103,7 @@ public:
instance->SetData(TYPE_THRALL_PART1, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 ad3e6979dfb..b48e0b376ea 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
@@ -95,7 +95,7 @@ public:
instance->SetData(TYPE_THRALL_PART4, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
index 65f496a579f..241bdc18be6 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
@@ -150,7 +150,7 @@ public:
Talk(SAY_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//TODO: make this work
if (CanPatrol && wpId == 0)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index 4a4ba4f3ce2..0fce48939af 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -536,7 +536,7 @@ public:
Talk(SAY_TH_RANDOM_DIE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
@@ -642,7 +642,7 @@ public:
void Reset() {}
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
index 222937621a8..695f9d2973e 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp
@@ -65,7 +65,7 @@ public:
me->SummonCreature(13716, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 600000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
index c6c0387026c..eea34e1949f 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp
@@ -62,7 +62,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
index 3fcd840077f..96c3c4a6c45 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp
@@ -69,7 +69,7 @@ public:
Add->AI()->AttackStart(victim);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Invisible && InvisibleTimer <= diff)
{
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
index eda5f125b00..ddce2f658e7 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
@@ -69,7 +69,7 @@ public:
me->SummonCreature(12238, 28.067f, 61.875f, -123.405f, 4.67f, TEMPSUMMON_TIMED_DESPAWN, 600000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 4724794d03b..e01f2b097b0 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -341,7 +341,7 @@ public:
MovePoint = iTemp;
}
- void UpdateAI(const uint32 Diff)
+ void UpdateAI(uint32 Diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
index d272b3cc84c..374652ee91d 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
@@ -81,7 +81,7 @@ public:
Talk(SAY_KILL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index b90d5a760d3..78535b7c3b0 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -142,7 +142,7 @@ public:
uiWebTimer = urand(5000, 8000);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
index cfc35b676ea..20872903c7b 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp
@@ -144,7 +144,7 @@ class boss_ayamiss : public CreatureScript
me->GetMotionMaster()->MovePoint(POINT_AIR, AyamissAirPos);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -272,7 +272,7 @@ class npc_hive_zara_larva : public CreatureScript
ScriptedAI::AttackStart(victim);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
return;
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
index 285d893fe41..0ad077aaa4e 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
@@ -95,7 +95,7 @@ class boss_buru : public CreatureScript
_phase = PHASE_EGG;
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_EXPLODE)
if (_phase == PHASE_EGG)
@@ -133,7 +133,7 @@ class boss_buru : public CreatureScript
events.ScheduleEvent(EVENT_RESPAWN_EGG, 100000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -197,11 +197,12 @@ class npc_buru_egg : public CreatureScript
public:
npc_buru_egg() : CreatureScript("npc_buru_egg") { }
- struct npc_buru_eggAI : public Scripted_NoMovementAI
+ struct npc_buru_eggAI : public ScriptedAI
{
- npc_buru_eggAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_buru_eggAI(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
+ SetCombatMovement(false);
}
void EnterCombat(Unit* attacker)
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
index ddb9017f3dd..033980d746b 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
@@ -81,7 +81,7 @@ class boss_kurinnaxx : public CreatureScript
sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
index 70db1213394..dd52872e1da 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
@@ -80,7 +80,7 @@ class boss_moam : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -105,7 +105,7 @@ class boss_moam : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
index 20c0dd035a4..f29f4999d2d 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
@@ -117,7 +117,7 @@ class boss_ossirian : public CreatureScript
}
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
if (action == ACTION_TRIGGER_WEAKNESS)
if (Creature* Trigger = me->GetMap()->GetCreature(TriggerGUID))
@@ -212,7 +212,7 @@ class boss_ossirian : public CreatureScript
BossAI::MoveInLineOfSight(who);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
index dae447e43d2..a7151ec7c05 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
@@ -86,7 +86,7 @@ class boss_rajaxx : public CreatureScript
_EnterCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
index 2a9ea4ba4fc..becbd126d9b 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
@@ -89,7 +89,7 @@ public:
instance->SetData(DATA_BUG_TRIO_DEATH, 1);
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -185,7 +185,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -274,10 +274,11 @@ public:
for (uint8 i = 0; i < 10; ++i)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- Creature* Summoned = me->SummonCreature(15621, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
- if (Summoned && target)
- Summoned->AI()->AttackStart(target);
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ {
+ if (Creature* Summoned = me->SummonCreature(15621, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000))
+ Summoned->AI()->AttackStart(target);
+ }
}
}
@@ -285,7 +286,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index 3da1fc1dc5c..e6460c00ab6 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -156,13 +156,15 @@ public:
return new eye_of_cthunAI (creature);
}
- struct eye_of_cthunAI : public Scripted_NoMovementAI
+ struct eye_of_cthunAI : public ScriptedAI
{
- eye_of_cthunAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ eye_of_cthunAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
if (!instance)
sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI");
+
+ SetCombatMovement(false);
}
InstanceScript* instance;
@@ -228,7 +230,7 @@ public:
Spawned->AI()->AttackStart(target);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
@@ -460,9 +462,9 @@ public:
return new cthunAI (creature);
}
- struct cthunAI : public Scripted_NoMovementAI
+ struct cthunAI : public ScriptedAI
{
- cthunAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ cthunAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
@@ -579,7 +581,7 @@ public:
return (*j);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
@@ -893,7 +895,7 @@ public:
}
}
- void DoAction(const int32 param)
+ void DoAction(int32 param)
{
switch (param)
{
@@ -916,15 +918,17 @@ public:
return new eye_tentacleAI (creature);
}
- struct eye_tentacleAI : public Scripted_NoMovementAI
+ struct eye_tentacleAI : public ScriptedAI
{
- eye_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ eye_tentacleAI(Creature* creature) : ScriptedAI(creature)
{
if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
Portal = pPortal->GetGUID();
}
+
+ SetCombatMovement(false);
}
uint32 MindflayTimer;
@@ -951,7 +955,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
@@ -989,9 +993,9 @@ public:
return new claw_tentacleAI (creature);
}
- struct claw_tentacleAI : public Scripted_NoMovementAI
+ struct claw_tentacleAI : public ScriptedAI
{
- claw_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ claw_tentacleAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
@@ -1026,7 +1030,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
@@ -1099,9 +1103,9 @@ public:
return new giant_claw_tentacleAI (creature);
}
- struct giant_claw_tentacleAI : public Scripted_NoMovementAI
+ struct giant_claw_tentacleAI : public ScriptedAI
{
- giant_claw_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ giant_claw_tentacleAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
@@ -1138,7 +1142,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
@@ -1218,9 +1222,9 @@ public:
return new giant_eye_tentacleAI (creature);
}
- struct giant_eye_tentacleAI : public Scripted_NoMovementAI
+ struct giant_eye_tentacleAI : public ScriptedAI
{
- giant_eye_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ giant_eye_tentacleAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
@@ -1251,7 +1255,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check if we have a target
if (!UpdateVictim())
@@ -1282,9 +1286,9 @@ public:
return new flesh_tentacleAI (creature);
}
- struct flesh_tentacleAI : public Scripted_NoMovementAI
+ struct flesh_tentacleAI : public ScriptedAI
{
- flesh_tentacleAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ flesh_tentacleAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
}
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
index 80fdc111911..de941ec266f 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
@@ -97,7 +97,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -137,9 +137,7 @@ public:
{
if (SpawnHatchlings_Timer <= diff)
{
- Unit* target = NULL;
- target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target && target->GetTypeId() == TYPEID_PLAYER)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
{
DoCast(target, SPELL_ROOT);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
index 5493e9d76b0..f8cf0917c37 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
@@ -80,7 +80,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
index 53242d4cdc6..9b095b0100a 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
@@ -78,7 +78,7 @@ public:
DoCast(me->getVictim(), SPELL_BIRTH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
index 3915a7655c5..d4bb5416a4e 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
@@ -98,7 +98,7 @@ public:
Talk(SAY_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -225,7 +225,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
index 8030358a068..034b27f081e 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
@@ -134,7 +134,7 @@ class boss_skeram : public CreatureScript
Talk(SAY_AGGRO);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index d623963e929..86ab6371789 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -429,7 +429,7 @@ public:
target->SetFullHealth();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -518,7 +518,7 @@ public:
target->SetFullHealth();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index fcbe3a84d62..413149e0d5e 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -194,7 +194,7 @@ class boss_viscidus : public CreatureScript
summons.DespawnAll();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index 7189abcc4fa..a4a5e0d94be 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -208,7 +208,7 @@ public:
summoned->AI()->AttackStart(me);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (currentEvent != TYPE_NARALEX_PART3)
npc_escortAI::UpdateAI(diff);
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index ee89c9b6cad..59c91dbd549 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -124,7 +124,7 @@ public:
me->setFaction(FACTION_FRIENDLY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (postGossipStep>0 && postGossipStep<4)
{
@@ -182,7 +182,7 @@ public:
DoMeleeAttackIfReady();
}
- void DoAction(const int32 /*param*/)
+ void DoAction(int32 /*param*/)
{
postGossipStep=1;
Text_Timer = 0;
@@ -331,7 +331,7 @@ public:
instance->SetData(0, DONE);*/
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -376,7 +376,7 @@ public:
}
}
- void DoAction(const int32 /*param*/)
+ void DoAction(int32 /*param*/)
{
DestroyDoor();
}
diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp
index 4f37cacac02..dd202247aaa 100644
--- a/src/server/scripts/Kalimdor/boss_azuregos.cpp
+++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp
@@ -81,7 +81,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/zone_ashenvale.cpp b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
index 94c68a1d3ec..ec24e870ae9 100644
--- a/src/server/scripts/Kalimdor/zone_ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
@@ -124,7 +124,7 @@ class npc_torek : public CreatureScript
summoned->AI()->AttackStart(me);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
@@ -242,7 +242,7 @@ class npc_ruul_snowhoof : public CreatureScript
summoned->AI()->AttackStart(me);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
@@ -411,7 +411,7 @@ class npc_muglash : public CreatureScript
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
diff --git a/src/server/scripts/Kalimdor/zone_azshara.cpp b/src/server/scripts/Kalimdor/zone_azshara.cpp
index 44f7e1e8172..bb27e172e5e 100644
--- a/src/server/scripts/Kalimdor/zone_azshara.cpp
+++ b/src/server/scripts/Kalimdor/zone_azshara.cpp
@@ -78,7 +78,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// we mustn't remove the Creature in the same round in which we cast the summon spell, otherwise there will be no summons
if (spellhit && morphtimer >= 5000)
@@ -332,7 +332,7 @@ public:
Reached = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (MustDie)
{
@@ -485,7 +485,7 @@ public:
WeMustDieTimer = 1000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (WeMustDie)
{
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index 4b03cd65cad..3f4b1d82b8d 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -124,7 +124,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (SayThanksTimer)
{
@@ -254,7 +254,7 @@ public:
Talk(ATTACK_YELL, who->GetGUID());
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat() && !IsTreeEvent)
{
@@ -321,7 +321,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
};
@@ -555,7 +555,7 @@ public:
sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!");
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (SayTimer <= diff)
{
@@ -626,7 +626,7 @@ public:
me->SetReactState(REACT_PASSIVE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -712,7 +712,7 @@ class npc_stillpine_capitive : public CreatureScript
_events.ScheduleEvent(EVENT_DESPAWN, 3500);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!_movementComplete)
return;
diff --git a/src/server/scripts/Kalimdor/zone_darkshore.cpp b/src/server/scripts/Kalimdor/zone_darkshore.cpp
index 09f061148d3..30f5283f716 100644
--- a/src/server/scripts/Kalimdor/zone_darkshore.cpp
+++ b/src/server/scripts/Kalimdor/zone_darkshore.cpp
@@ -143,7 +143,7 @@ public:
SetFollowPaused(false);
}
- void UpdateFollowerAI(const uint32 Diff)
+ void UpdateFollowerAI(uint32 Diff)
{
if (!UpdateVictim())
{
diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp
index 8f55bb6102c..b21cb28e0d5 100644
--- a/src/server/scripts/Kalimdor/zone_desolace.cpp
+++ b/src/server/scripts/Kalimdor/zone_desolace.cpp
@@ -39,7 +39,6 @@ EndContentData */
enum DyingKodo
{
- // signed for 9999
SAY_SMEED_HOME = 0,
QUEST_KODO = 5561,
@@ -51,7 +50,7 @@ enum DyingKodo
NPC_TAMED_KODO = 11627,
SPELL_KODO_KOMBO_ITEM = 18153,
- SPELL_KODO_KOMBO_PLAYER_BUFF = 18172, //spells here have unclear function, but using them at least for visual parts and checks
+ SPELL_KODO_KOMBO_PLAYER_BUFF = 18172,
SPELL_KODO_KOMBO_DESPAWN_BUFF = 18377,
SPELL_KODO_KOMBO_GOSSIP = 18362
@@ -66,111 +65,56 @@ public:
{
if (player->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && creature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
{
- //the expected quest objective
- player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
-
+ player->TalkedToCreature(creature->GetEntry(), 0);
player->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF);
- creature->GetMotionMaster()->MoveIdle();
}
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
- bool EffectDummyCreature(Unit* pCaster, uint32 spellId, uint32 effIndex, Creature* creatureTarget)
- {
- //always check spellid and effectindex
- if (spellId == SPELL_KODO_KOMBO_ITEM && effIndex == 0)
- {
- //no effect if player/creature already have aura from spells
- if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || creatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
- return true;
-
- if (creatureTarget->GetEntry() == NPC_AGED_KODO ||
- creatureTarget->GetEntry() == NPC_DYING_KODO ||
- creatureTarget->GetEntry() == NPC_ANCIENT_KODO)
- {
- pCaster->CastSpell(pCaster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
-
- creatureTarget->UpdateEntry(NPC_TAMED_KODO);
- creatureTarget->CastSpell(creatureTarget, SPELL_KODO_KOMBO_DESPAWN_BUFF, false);
-
- if (creatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
- creatureTarget->GetMotionMaster()->MoveIdle();
-
- creatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, creatureTarget->GetFollowAngle());
- }
-
- //always return true when we are handling this spell and effect
- return true;
- }
- return false;
- }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_aged_dying_ancient_kodoAI(creature);
- }
-
struct npc_aged_dying_ancient_kodoAI : public ScriptedAI
{
- npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) { Reset(); }
-
- uint32 DespawnTimer;
+ npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) {}
- void Reset()
+ void MoveInLineOfSight(Unit* who)
{
- DespawnTimer = 0;
+ if (who->GetEntry() == NPC_SMEED && me->IsWithinDistInMap(who, 10.0f) && !me->HasAura(SPELL_KODO_KOMBO_GOSSIP))
+ {
+ me->GetMotionMaster()->Clear();
+ DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true);
+ if (Creature* smeed = who->ToCreature())
+ smeed->AI()->Talk(SAY_SMEED_HOME);
+ }
}
- void MoveInLineOfSight(Unit* who)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
- if (who->GetEntry() == NPC_SMEED)
+ if (spell->Id == SPELL_KODO_KOMBO_ITEM)
{
- if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
- return;
-
- if (me->IsWithinDistInMap(who, 10.0f))
+ if (!(caster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || me->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
+ && (me->GetEntry() == NPC_AGED_KODO || me->GetEntry() == NPC_DYING_KODO || me->GetEntry() == NPC_ANCIENT_KODO))
{
- if (Creature* talker = who->ToCreature())
- talker->AI()->Talk(SAY_SMEED_HOME);
+ caster->CastSpell(caster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
+ DoCast(me, SPELL_KODO_KOMBO_DESPAWN_BUFF, true);
- //spell have no implemented effect (dummy), so useful to notify spellHit
- DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true);
+ me->UpdateEntry(NPC_TAMED_KODO);
+ me->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, me->GetFollowAngle());
}
}
- }
-
- void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell)
- {
- if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP)
+ else if (spell->Id == SPELL_KODO_KOMBO_GOSSIP)
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- DespawnTimer = 60000;
+ me->DespawnOrUnsummon(60000);
}
}
-
- void UpdateAI(const uint32 diff)
- {
- //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat.
- if (DespawnTimer && DespawnTimer <= diff)
- {
- if (!me->getVictim() && me->isAlive())
- {
- Reset();
- me->setDeathState(JUST_DIED);
- me->Respawn();
- return;
- }
- } else DespawnTimer -= diff;
-
- if (!UpdateVictim())
- return;
-
- DoMeleeAttackIfReady();
- }
};
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_aged_dying_ancient_kodoAI(creature);
+ }
+
};
/*######
@@ -261,7 +205,7 @@ public:
return;
}
- void UpdateAI(const uint32 Diff)
+ void UpdateAI(uint32 Diff)
{
npc_escortAI::UpdateAI(Diff);
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp
index fa6b830c1ae..6e474655db3 100644
--- a/src/server/scripts/Kalimdor/zone_durotar.cpp
+++ b/src/server/scripts/Kalimdor/zone_durotar.cpp
@@ -84,7 +84,7 @@ public:
}
}
- void UpdateAI(const uint32 Diff)
+ void UpdateAI(uint32 Diff)
{
if (work == true)
me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD);
@@ -175,14 +175,15 @@ class npc_tiger_matriarch_credit : public CreatureScript
public:
npc_tiger_matriarch_credit() : CreatureScript("npc_tiger_matriarch_credit") { }
- struct npc_tiger_matriarch_creditAI : public Scripted_NoMovementAI
+ struct npc_tiger_matriarch_creditAI : public ScriptedAI
{
- npc_tiger_matriarch_creditAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_tiger_matriarch_creditAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
events.ScheduleEvent(EVENT_CHECK_SUMMON_AURA, 2000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
@@ -294,7 +295,7 @@ class npc_tiger_matriarch : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
index 37941227c78..f1789ff5139 100644
--- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp
@@ -95,7 +95,7 @@ class mobs_risen_husk_spirit : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -204,7 +204,7 @@ public:
Step = 0;
}
- void UpdateAI(const uint32 Diff)
+ void UpdateAI(uint32 Diff)
{
if (!me->HasAura(SPELL_PROPAGANDIZED))
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -458,7 +458,7 @@ public:
Talk(SAY_ZELFRAX2);
}
- void UpdateAI(uint32 const /*Diff*/)
+ void UpdateAI(uint32 /*Diff*/)
{
if (!UpdateVictim())
return;
@@ -583,7 +583,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp
index e41ffae03e6..b5be4ac1a6d 100644
--- a/src/server/scripts/Kalimdor/zone_moonglade.cpp
+++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp
@@ -383,7 +383,7 @@ public:
return;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
@@ -630,7 +630,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -677,7 +677,7 @@ public:
events.ScheduleEvent(EVENT_DESPAWN, 5*MINUTE*IN_MILLISECONDS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
diff --git a/src/server/scripts/Kalimdor/zone_mulgore.cpp b/src/server/scripts/Kalimdor/zone_mulgore.cpp
index aca55284b67..b81b8eb9eb7 100644
--- a/src/server/scripts/Kalimdor/zone_mulgore.cpp
+++ b/src/server/scripts/Kalimdor/zone_mulgore.cpp
@@ -147,7 +147,7 @@ public:
IsMovingToLunch = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (EventActive)
{
@@ -303,7 +303,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (newWaypoint)
{
diff --git a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp
index 42ef9843a4e..1d4806e7f97 100644
--- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp
+++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp
@@ -83,7 +83,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (CanEmote)
{
@@ -224,7 +224,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index a612269eff7..70e7f731fc4 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -791,7 +791,7 @@ public:
}
++AnimationCount;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (AnimationTimer)
{
@@ -843,7 +843,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void JustDied(Unit* /*slayer*/);
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Timers)
{
@@ -1045,7 +1045,7 @@ public:
Announced = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!PlayerGUID || !EventStarted)
return;
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index 0648e40416d..9d257790ab8 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -104,7 +104,7 @@ public:
Talk(AGGRO_YELL_AQUE, who->GetGUID());
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (isFriendly)
{
@@ -270,7 +270,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void Reset() {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
@@ -603,7 +603,7 @@ public:
SetFollowComplete();
}
- void UpdateFollowerAI(const uint32 Diff)
+ void UpdateFollowerAI(uint32 Diff)
{
if (!UpdateVictim())
{
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index b349de8f083..ff52af97c11 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -278,7 +278,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsFriend)
{
@@ -397,7 +397,7 @@ public:
void KilledUnit(Unit* /*victim*/) { }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (EventInProgress) {
Player* pWarrior = NULL;
diff --git a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
index 9c47991a5d5..02e64421ecb 100644
--- a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
+++ b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
@@ -368,7 +368,7 @@ public:
}
}
- void UpdateAI(const uint32 Diff)
+ void UpdateAI(uint32 Diff)
{
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
{
@@ -441,7 +441,7 @@ public:
me->SetReactState(REACT_PASSIVE);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp b/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp
index 0d915dc7c44..cd2e8308e6a 100644
--- a/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp
+++ b/src/server/scripts/Kalimdor/zone_thunder_bluff.cpp
@@ -98,15 +98,14 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
if (BerserkerChargeTimer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_BERSERKER_CHARGE);
BerserkerChargeTimer = 25000;
} else BerserkerChargeTimer -= diff;
diff --git a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
index e72c82bee97..9c89ad6d53a 100644
--- a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
@@ -126,7 +126,7 @@ public:
player->FailQuest(QUEST_CHASING_AME);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
@@ -261,7 +261,7 @@ public:
SetFollowPaused(false);
}
- void UpdateFollowerAI(const uint32 Diff)
+ void UpdateFollowerAI(uint32 Diff)
{
if (!UpdateVictim())
{
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index d484e2a4279..24335c0e469 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -129,7 +129,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -182,9 +182,9 @@ class mob_amanitar_mushrooms : public CreatureScript
public:
mob_amanitar_mushrooms() : CreatureScript("mob_amanitar_mushrooms") { }
- struct mob_amanitar_mushroomsAI : public Scripted_NoMovementAI
+ struct mob_amanitar_mushroomsAI : public ScriptedAI
{
- mob_amanitar_mushroomsAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ mob_amanitar_mushroomsAI(Creature* creature) : ScriptedAI(creature) {}
EventMap events;
@@ -211,7 +211,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*victim*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 ac668c33874..a9fad9c5451 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
@@ -139,7 +139,7 @@ class boss_elder_nadox : public CreatureScript
instance->SetData(DATA_ELDER_NADOX_EVENT, DONE);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -218,7 +218,7 @@ class mob_ahnkahar_nerubian : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_GUARDIAN_AURA);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -254,9 +254,9 @@ class mob_nadox_eggs : public CreatureScript
public:
mob_nadox_eggs() : CreatureScript("mob_nadox_eggs") { }
- struct mob_nadox_eggsAI : public Scripted_NoMovementAI
+ struct mob_nadox_eggsAI : public ScriptedAI
{
- mob_nadox_eggsAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ mob_nadox_eggsAI(Creature* creature) : ScriptedAI(creature)
{
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
creature->UpdateAllStats();
@@ -266,7 +266,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*victim*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
CreatureAI* GetAI(Creature* creature) const
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 7f6709b34fa..82ac2e8387c 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
@@ -258,7 +258,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -322,5 +322,5 @@ public:
void AddSC_boss_volazj()
{
- new boss_volazj;
+ new boss_volazj();
}
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 c36bcf9708f..e8b17224179 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -150,7 +150,7 @@ public:
instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, DONE);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_INITIAND_KILLED)
volunteerWork = false;
@@ -280,7 +280,7 @@ public:
bCanDown = true;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance)
return;
@@ -451,7 +451,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance && bCheckTimer <= diff)
{
@@ -523,15 +523,17 @@ class npc_jedogas_aufseher_trigger : public CreatureScript
public:
npc_jedogas_aufseher_trigger() : CreatureScript("npc_jedogas_aufseher_trigger") { }
- struct npc_jedogas_aufseher_triggerAI : public Scripted_NoMovementAI
+ struct npc_jedogas_aufseher_triggerAI : public ScriptedAI
{
- npc_jedogas_aufseher_triggerAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_jedogas_aufseher_triggerAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
bRemoved = false;
bRemoved2 = false;
bCasted = false;
bCasted2 = false;
+
+ SetCombatMovement(false);
}
InstanceScript* instance;
@@ -546,7 +548,7 @@ public:
void AttackStart(Unit* /*victim*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!instance)
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 8f77cc7ec6f..a68cbcb7ee6 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -121,7 +121,7 @@ public:
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -370,7 +370,7 @@ public:
DoCast(me, SPELL_FLAME_SPHERE_DEATH_EFFECT);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiDespawnTimer <= diff)
me->DisappearAndDie();
@@ -424,7 +424,7 @@ public:
void AddSC_boss_taldaram()
{
- new boss_taldaram;
- new mob_taldaram_flamesphere;
- new prince_taldaram_sphere;
+ new boss_taldaram();
+ new mob_taldaram_flamesphere();
+ new prince_taldaram_sphere();
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
index db4959ae670..26a4aeeca01 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
@@ -336,5 +336,5 @@ public:
void AddSC_instance_ahnkahet()
{
- new instance_ahnkahet;
+ new instance_ahnkahet();
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index 1442ff265f4..1ec61488c1b 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -168,7 +168,7 @@ public:
instance->SetData(DATA_ANUBARAK_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -360,5 +360,5 @@ public:
void AddSC_boss_anub_arak()
{
- new boss_anub_arak;
+ new boss_anub_arak();
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
index 6c707a8388f..eec7959f56f 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
@@ -134,7 +134,7 @@ public:
EnterEvadeMode();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -198,5 +198,5 @@ public:
void AddSC_boss_hadronox()
{
- new boss_hadronox;
+ new boss_hadronox();
}
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 aa329f12f6a..295f38658e2 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
@@ -138,7 +138,7 @@ public:
me->SummonCreature(MOB_SKITTERING_SWARMER, SpawnPoint[7], TEMPSUMMON_TIMED_DESPAWN, 25*IN_MILLISECONDS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -239,7 +239,7 @@ public:
uiBackstabTimer = 7*IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -290,7 +290,7 @@ public:
uiShadowNovaTimer = 15*IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -336,7 +336,7 @@ public:
uiStrikeTimer = 6*IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -386,7 +386,7 @@ public:
DoCast(me, SPELL_ENRAGE, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -434,7 +434,7 @@ public:
uiBindingWebsTimer = 17*IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -488,7 +488,7 @@ public:
uiPoisonSprayTimer = 15*IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 7873cadd096..875aafe9826 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
@@ -213,5 +213,5 @@ public:
void AddSC_instance_azjol_nerub()
{
- new instance_azjol_nerub;
+ new instance_azjol_nerub();
}
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
index f5864fe7b8f..bbec79ea43d 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
@@ -547,7 +547,7 @@ public:
(*itr)->CastSpell(target, SPELL_LAVA_STRIKE, true);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -954,7 +954,7 @@ struct dummy_dragonAI : public ScriptedAI
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (m_bCanMoveFree && m_uiMoveNextTimer)
{
@@ -1017,7 +1017,7 @@ public:
Talk(SAY_TENEBRON_SLAY);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//if no target, update dummy and return
if (!UpdateVictim())
@@ -1112,7 +1112,7 @@ public:
Talk(SAY_SHADRON_SLAY);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//if no target, update dummy and return
if (!UpdateVictim())
@@ -1210,7 +1210,7 @@ public:
Talk(SAY_VESPERON_SLAY);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//if no target, update dummy and return
if (!UpdateVictim())
@@ -1352,7 +1352,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiDespawnTimer < uiDiff)
{
@@ -1447,7 +1447,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiDespawnTimer < uiDiff)
{
@@ -1480,10 +1480,11 @@ public:
return new mob_twilight_eggsAI(creature);
}
- struct mob_twilight_eggsAI : public Scripted_NoMovementAI
+ struct mob_twilight_eggsAI : public ScriptedAI
{
- mob_twilight_eggsAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ mob_twilight_eggsAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
instance = creature->GetInstanceScript();
}
@@ -1518,7 +1519,7 @@ public:
who->SetInCombatWithZone();
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (m_uiHatchEggTimer <= uiDiff)
{
@@ -1572,7 +1573,7 @@ public:
entry = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Tsunami_Timer <= diff)
{
@@ -1602,11 +1603,11 @@ public:
return new npc_twilight_fissureAI(creature);
}
- struct npc_twilight_fissureAI : public Scripted_NoMovementAI
+ struct npc_twilight_fissureAI : public ScriptedAI
{
- npc_twilight_fissureAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_twilight_fissureAI(Creature* creature) : ScriptedAI(creature)
{
- Reset();
+ SetCombatMovement(false);
}
uint32 VoidBlast_Timer;
@@ -1620,7 +1621,7 @@ public:
VoidBlast_Timer = 5000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (VoidBlast_Timer <= diff)
{
@@ -1667,7 +1668,7 @@ public:
m_uiFadeArmorTimer = 1000;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
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 205a0b10d69..d3a685bc6ba 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
@@ -61,9 +61,7 @@ enum Phases
{
PHASE_ALL = 0,
PHASE_INTRO = 1,
- PHASE_COMBAT = 2,
-
- PHASE_INTRO_MASK = 1 << PHASE_INTRO,
+ PHASE_COMBAT = 2
};
class boss_baltharus_the_warborn : public CreatureScript
@@ -87,7 +85,7 @@ class boss_baltharus_the_warborn : public CreatureScript
instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetMaxHealth());
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -164,17 +162,18 @@ class boss_baltharus_the_warborn : public CreatureScript
instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if (!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
+ bool introPhase = events.IsInPhase(PHASE_INTRO);
+ if (!UpdateVictim() && !introPhase)
return;
- if (!(events.GetPhaseMask() & PHASE_INTRO_MASK))
+ if (!introPhase)
me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH));
events.Update(diff);
- if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
+ if (me->HasUnitState(UNIT_STATE_CASTING) && !introPhase)
return;
while (uint32 eventId = events.ExecuteEvent())
@@ -258,7 +257,7 @@ class npc_baltharus_the_warborn_clone : public CreatureScript
killer->Kill(baltharus);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 94325ca015b..c616d44816c 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
@@ -140,7 +140,7 @@ class boss_general_zarithrian : public CreatureScript
return (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index 6039e01b901..fd70a073a39 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -165,12 +165,7 @@ enum Phases
PHASE_INTRO = 1,
PHASE_ONE = 2,
PHASE_TWO = 3,
- PHASE_THREE = 4,
-
- PHASE_INTRO_MASK = 1 << PHASE_INTRO,
- PHASE_ONE_MASK = 1 << PHASE_ONE,
- PHASE_TWO_MASK = 1 << PHASE_TWO,
- PHASE_THREE_MASK = 1 << PHASE_THREE
+ PHASE_THREE = 4
};
enum Misc
@@ -248,7 +243,7 @@ struct generic_halionAI : public BossAI
_JustReachedHome();
}
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -267,7 +262,7 @@ struct generic_halionAI : public BossAI
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
return;
@@ -325,7 +320,7 @@ class boss_halion : public CreatureScript
void EnterEvadeMode()
{
// Phase 1: We always can evade. Phase 2 & 3: We can evade if and only if the controller tells us to.
- if ((events.GetPhaseMask() & PHASE_ONE_MASK) || _canEvade)
+ if (events.IsInPhase(PHASE_ONE) || _canEvade)
generic_halionAI::EnterEvadeMode();
}
@@ -369,7 +364,7 @@ class boss_halion : public CreatureScript
void DamageTaken(Unit* attacker, uint32& damage)
{
- if (me->HealthBelowPctDamaged(75, damage) && (events.GetPhaseMask() & PHASE_ONE_MASK))
+ if (me->HealthBelowPctDamaged(75, damage) && events.IsInPhase(PHASE_ONE))
{
events.SetPhase(PHASE_TWO);
Talk(SAY_PHASE_TWO);
@@ -383,7 +378,7 @@ class boss_halion : public CreatureScript
return;
}
- if (events.GetPhaseMask() & PHASE_THREE_MASK)
+ if (events.IsInPhase(PHASE_THREE))
{
// Don't consider copied damage.
if (!me->InSamePhase(attacker))
@@ -394,15 +389,15 @@ class boss_halion : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if (events.GetPhaseMask() & PHASE_TWO_MASK)
+ if (events.IsInPhase(PHASE_TWO))
return;
generic_halionAI::UpdateAI(diff);
}
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -528,7 +523,7 @@ class boss_twilight_halion : public CreatureScript
void DamageTaken(Unit* attacker, uint32& damage)
{
- if (me->HealthBelowPctDamaged(50, damage) && (events.GetPhaseMask() & PHASE_TWO_MASK))
+ if (me->HealthBelowPctDamaged(50, damage) && events.IsInPhase(PHASE_TWO))
{
events.SetPhase(PHASE_THREE);
me->CastStop();
@@ -537,7 +532,7 @@ class boss_twilight_halion : public CreatureScript
return;
}
- if (events.GetPhaseMask() & PHASE_THREE_MASK)
+ if (events.IsInPhase(PHASE_THREE))
{
// Don't consider copied damage.
if (!me->InSamePhase(attacker))
@@ -562,7 +557,7 @@ class boss_twilight_halion : public CreatureScript
}
}
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -646,7 +641,7 @@ class npc_halion_controller : public CreatureScript
_instance->SetBossState(DATA_HALION, FAIL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -688,12 +683,12 @@ class npc_halion_controller : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// The isInCombat() check is needed because that check should be false when Halion is
// not engaged, while it would return true without as UpdateVictim() checks for
// combat state.
- if (!(_events.GetPhaseMask() & PHASE_INTRO_MASK) && me->isInCombat() && !UpdateVictim())
+ if (!(_events.IsInPhase(PHASE_INTRO)) && me->isInCombat() && !UpdateVictim())
{
EnterEvadeMode();
return;
@@ -917,7 +912,7 @@ class npc_orb_carrier : public CreatureScript
ASSERT(creature->GetVehicleKit());
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
/// According to sniffs this spell is cast every 1 or 2 seconds.
/// However, refreshing it looks bad, so just cast the spell if
@@ -933,7 +928,7 @@ class npc_orb_carrier : public CreatureScript
me->SetFacingToObject(rotationFocus); // setInFront
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_SHOOT)
{
@@ -978,13 +973,15 @@ class npc_meteor_strike_initial : public CreatureScript
public:
npc_meteor_strike_initial() : CreatureScript("npc_meteor_strike_initial") { }
- struct npc_meteor_strike_initialAI : public Scripted_NoMovementAI
+ struct npc_meteor_strike_initialAI : public ScriptedAI
{
- npc_meteor_strike_initialAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ npc_meteor_strike_initialAI(Creature* creature) : ScriptedAI(creature),
_instance(creature->GetInstanceScript())
- { }
+ {
+ SetCombatMovement(false);
+ }
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -1032,7 +1029,7 @@ class npc_meteor_strike_initial : public CreatureScript
}
}
- void UpdateAI(uint32 const /*diff*/) { }
+ void UpdateAI(uint32 /*diff*/) { }
void EnterEvadeMode() { }
private:
InstanceScript* _instance;
@@ -1050,16 +1047,18 @@ class npc_meteor_strike : public CreatureScript
public:
npc_meteor_strike() : CreatureScript("npc_meteor_strike") { }
- struct npc_meteor_strikeAI : public Scripted_NoMovementAI
+ struct npc_meteor_strikeAI : public ScriptedAI
{
- npc_meteor_strikeAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ npc_meteor_strikeAI(Creature* creature) : ScriptedAI(creature),
_instance(creature->GetInstanceScript())
{
_range = 5.0f;
_spawnCount = 0;
+
+ SetCombatMovement(false);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_METEOR_STRIKE_BURN)
{
@@ -1076,7 +1075,7 @@ class npc_meteor_strike : public CreatureScript
controller->AI()->JustSummoned(me);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (_spawnCount > 5)
return;
@@ -1119,11 +1118,13 @@ class npc_combustion_consumption : public CreatureScript
public:
npc_combustion_consumption() : CreatureScript("npc_combustion_consumption") { }
- struct npc_combustion_consumptionAI : public Scripted_NoMovementAI
+ struct npc_combustion_consumptionAI : public ScriptedAI
{
- npc_combustion_consumptionAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ npc_combustion_consumptionAI(Creature* creature) : ScriptedAI(creature),
_instance(creature->GetInstanceScript()), _summonerGuid(0)
{
+ SetCombatMovement(false);
+
switch (me->GetEntry())
{
case NPC_COMBUSTION:
@@ -1169,7 +1170,7 @@ class npc_combustion_consumption : public CreatureScript
summoner->CastCustomSpell(_explosionSpell, SPELLVALUE_BASE_POINT0, damage, summoner);
}
- void UpdateAI(uint32 const /*diff*/) { }
+ void UpdateAI(uint32 /*diff*/) { }
private:
InstanceScript* _instance;
@@ -1248,7 +1249,7 @@ class npc_living_ember : public CreatureScript
me->DespawnOrUnsummon(1);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
return;
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 06743858ec0..d391abb0d4d 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
@@ -141,7 +141,7 @@ class boss_saviana_ragefire : public CreatureScript
Talk(SAY_KILL);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
index 5baae66e65b..2623b2c542a 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
@@ -66,7 +66,7 @@ class npc_xerestrasza : public CreatureScript
me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_BALTHARUS_DEATH)
{
@@ -92,7 +92,7 @@ class npc_xerestrasza : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (_isIntro)
return;
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 fb0f0fbaee1..553b836da8f 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -175,7 +175,7 @@ public:
me->DisappearAndDie();
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (bDone && uiResetTimer <= uiDiff)
{
@@ -299,7 +299,7 @@ public:
me->DisappearAndDie();
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (bDone && uiResetTimer <= uiDiff)
{
@@ -403,7 +403,7 @@ public:
uiWakingNightmare = 7000;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -545,7 +545,7 @@ public:
uiWaypoint = uiType;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
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 ceb9724a078..b253d15773d 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
@@ -153,7 +153,7 @@ public:
summon->AI()->AttackStart(me->getVictim());
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -320,7 +320,7 @@ public:
uiAttackTimer = 3500;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -362,7 +362,7 @@ public:
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
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 9299630b3d2..e637de75b4d 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
@@ -233,7 +233,7 @@ public:
DoCast(me, SPELL_SHIELD, true);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
@@ -360,7 +360,7 @@ public:
bHome = false;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!bDone && GrandChampionsOutVehicle(me))
{
@@ -494,7 +494,7 @@ public:
bHome = false;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!bDone && GrandChampionsOutVehicle(me))
{
@@ -639,7 +639,7 @@ public:
bHome = false;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!bDone && GrandChampionsOutVehicle(me))
{
@@ -785,7 +785,7 @@ public:
bHome = false;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!bDone && GrandChampionsOutVehicle(me))
{
@@ -933,7 +933,7 @@ public:
bHome = false;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!bDone && GrandChampionsOutVehicle(me))
{
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 7e4a740cb13..472048501a5 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
@@ -412,7 +412,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
ScriptedAI::UpdateAI(uiDiff);
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 e44f5fba1b8..9c6d481c207 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -154,9 +154,7 @@ enum Phases
{
// Anub'arak
PHASE_MELEE = 1,
- PHASE_SUBMERGED = 2,
-
- PHASE_MASK_MELEE = 1 << PHASE_MELEE
+ PHASE_SUBMERGED = 2
};
class boss_anubarak_trial : public CreatureScript
@@ -286,7 +284,7 @@ class boss_anubarak_trial : public CreatureScript
_sphereGUID[i] = summoned->GetGUID();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -403,7 +401,7 @@ class boss_anubarak_trial : public CreatureScript
}
- if (HealthBelowPct(30) && events.GetPhaseMask() & PHASE_MASK_MELEE && !_reachedPhase3)
+ if (HealthBelowPct(30) && events.IsInPhase(PHASE_MELEE) && !_reachedPhase3)
{
_reachedPhase3 = true;
DoCastAOE(SPELL_LEECHING_SWARM);
@@ -411,7 +409,7 @@ class boss_anubarak_trial : public CreatureScript
Talk(SAY_LEECHING_SWARM);
}
- if (events.GetPhaseMask() & PHASE_MASK_MELEE)
+ if (events.IsInPhase(PHASE_MELEE))
DoMeleeAttackIfReady();
}
@@ -453,7 +451,7 @@ class mob_swarm_scarab : public CreatureScript
Anubarak->AI()->JustSummoned(me);
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
switch (actionId)
{
@@ -471,7 +469,7 @@ class mob_swarm_scarab : public CreatureScript
DoCast(killer, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25));
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_instance && _instance->GetBossState(BOSS_ANUBARAK) != IN_PROGRESS)
me->DisappearAndDie();
@@ -527,7 +525,7 @@ class mob_nerubian_burrower : public CreatureScript
Anubarak->AI()->JustSummoned(me);
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
switch (actionId)
{
@@ -541,7 +539,7 @@ class mob_nerubian_burrower : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_instance && _instance->GetBossState(BOSS_ANUBARAK) != IN_PROGRESS)
me->DisappearAndDie();
@@ -702,7 +700,7 @@ class mob_anubarak_spike : public CreatureScript
uiDamage = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
{
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 ba554c3703d..f1bf0579187 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -710,7 +710,7 @@ struct boss_faction_championsAI : public BossAI
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
_events.Update(diff);
@@ -773,7 +773,7 @@ class mob_toc_druid : public CreatureScript
SetEquipmentSlots(false, 51799, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -865,7 +865,7 @@ class mob_toc_shaman : public CreatureScript
SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -959,7 +959,7 @@ class mob_toc_paladin : public CreatureScript
SetEquipmentSlots(false, 50771, 47079, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1062,7 +1062,7 @@ class mob_toc_priest : public CreatureScript
SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1152,7 +1152,7 @@ class mob_toc_shadow_priest : public CreatureScript
DoCast(me, SPELL_SHADOWFORM);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1251,7 +1251,7 @@ class mob_toc_warlock : public CreatureScript
DoCast(SPELL_SUMMON_FELHUNTER);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1337,7 +1337,7 @@ class mob_toc_mage : public CreatureScript
SetEquipmentSlots(false, 47524, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1437,7 +1437,7 @@ class mob_toc_hunter : public CreatureScript
DoCast(SPELL_CALL_PET);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1534,7 +1534,7 @@ class mob_toc_boomkin : public CreatureScript
SetEquipmentSlots(false, 50966, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1629,7 +1629,7 @@ class mob_toc_warrior : public CreatureScript
SetEquipmentSlots(false, 47427, 46964, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1728,7 +1728,7 @@ class mob_toc_dk : public CreatureScript
SetEquipmentSlots(false, 47518, 51021, EQUIP_NO_CHANGE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1827,7 +1827,7 @@ class mob_toc_rogue : public CreatureScript
me->SetMaxPower(POWER_ENERGY, 100);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1967,7 +1967,7 @@ class mob_toc_enh_shaman : public CreatureScript
summons.DespawnAll();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -2062,7 +2062,7 @@ class mob_toc_retro_paladin : public CreatureScript
DoCast(SPELL_SEAL_OF_COMMAND);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -2155,7 +2155,7 @@ class mob_toc_pet_warlock : public CreatureScript
events.ScheduleEvent(EVENT_SPELL_LOCK, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -2206,7 +2206,7 @@ class mob_toc_pet_hunter : public CreatureScript
_clawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 82cff5ff01f..74324d6c515 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -18,8 +18,9 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "trial_of_the_crusader.h"
#include "SpellScript.h"
+#include "Player.h"
+#include "trial_of_the_crusader.h"
enum Yells
{
@@ -69,7 +70,6 @@ enum BossSpells
SPELL_FEL_INFERNO = 67047,
SPELL_FEL_STREAK = 66494,
SPELL_LORD_HITTIN = 66326, // special effect preventing more specific spells be cast on the same player within 10 seconds
- SPELL_MISTRESS_KISS_DEBUFF = 66334,
SPELL_MISTRESS_KISS_DAMAGE_SILENCE = 66359
};
@@ -149,7 +149,7 @@ class boss_jaraxxus : public CreatureScript
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -223,10 +223,11 @@ class mob_legion_flame : public CreatureScript
public:
mob_legion_flame() : CreatureScript("mob_legion_flame") { }
- struct mob_legion_flameAI : public Scripted_NoMovementAI
+ struct mob_legion_flameAI : public ScriptedAI
{
- mob_legion_flameAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ mob_legion_flameAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
_instance = creature->GetInstanceScript();
}
@@ -237,7 +238,7 @@ class mob_legion_flame : public CreatureScript
DoCast(SPELL_LEGION_FLAME_EFFECT);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
UpdateVictim();
if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS)
@@ -258,10 +259,11 @@ class mob_infernal_volcano : public CreatureScript
public:
mob_infernal_volcano() : CreatureScript("mob_infernal_volcano") { }
- struct mob_infernal_volcanoAI : public Scripted_NoMovementAI
+ struct mob_infernal_volcanoAI : public ScriptedAI
{
- mob_infernal_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature), _summons(me)
+ mob_infernal_volcanoAI(Creature* creature) : ScriptedAI(creature), _summons(me)
{
+ SetCombatMovement(false);
}
void Reset()
@@ -294,7 +296,7 @@ class mob_infernal_volcano : public CreatureScript
me->DespawnOrUnsummon();
}
- void UpdateAI(uint32 const /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
private:
SummonList _summons;
@@ -324,7 +326,7 @@ class mob_fel_infernal : public CreatureScript
me->SetInCombatWithZone();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS)
{
@@ -398,7 +400,7 @@ class mob_nether_portal : public CreatureScript
me->DespawnOrUnsummon();
}
- void UpdateAI(uint32 const /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
private:
SummonList _summons;
@@ -439,7 +441,7 @@ class mob_mistress_of_pain : public CreatureScript
_instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, DECREASE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS)
{
@@ -533,6 +535,21 @@ class spell_mistress_kiss : public SpellScriptLoader
}
};
+class MistressKissTargetSelector
+{
+ public:
+ MistressKissTargetSelector() { }
+
+ bool operator()(WorldObject* unit) const
+ {
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ if (unit->ToPlayer()->getPowerType() == POWER_MANA)
+ return false;
+
+ return true;
+ }
+};
+
class spell_mistress_kiss_area : public SpellScriptLoader
{
public:
@@ -542,44 +559,27 @@ class spell_mistress_kiss_area : public SpellScriptLoader
{
PrepareSpellScript(spell_mistress_kiss_area_SpellScript)
- bool Load()
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- if (GetCaster())
- if (sSpellMgr->GetSpellIdForDifficulty(SPELL_MISTRESS_KISS_DEBUFF, GetCaster()))
- return true;
- return false;
- }
+ // get a list of players with mana
+ targets.remove_if(MistressKissTargetSelector());
+ if (targets.empty())
+ return;
- void HandleScript(SpellEffIndex /*effIndex*/)
- {
- Unit* caster = GetCaster();
- Unit* target = GetHitUnit();
- if (caster && target)
- caster->CastSpell(target, SPELL_MISTRESS_KISS_DEBUFF, true);
+ WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
+ targets.clear();
+ targets.push_back(target);
}
- void FilterTargets(std::list<WorldObject*>& targets)
+ void HandleScript(SpellEffIndex /*effIndex*/)
{
- // get a list of players with mana
- std::list<WorldObject*> _targets;
- for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
- if ((*itr)->ToUnit()->getPowerType() == POWER_MANA)
- _targets.push_back(*itr);
-
- // pick a random target and kiss him
- if (WorldObject* _target = Trinity::Containers::SelectRandomContainerElement(_targets))
- {
- // correctly fill "targets" for the visual effect
- targets.clear();
- targets.push_back(_target);
- if (Unit* caster = GetCaster())
- caster->CastSpell(_target->ToUnit(), SPELL_MISTRESS_KISS_DEBUFF, true);
- }
+ GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
void Register()
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mistress_kiss_area_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnEffectHitTarget += SpellEffectFn(spell_mistress_kiss_area_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
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 03a305356c4..c39b8403474 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -146,10 +146,7 @@ enum Phases
{
PHASE_MOBILE = 1,
PHASE_STATIONARY = 2,
- PHASE_SUBMERGED = 3,
-
- PHASE_MASK_MOBILE = 1 << PHASE_MOBILE,
- PHASE_MASK_STATIONARY = 1 << PHASE_STATIONARY
+ PHASE_SUBMERGED = 3
};
class boss_gormok : public CreatureScript
@@ -238,7 +235,7 @@ class boss_gormok : public CreatureScript
pSnobold->ToCreature()->DespawnOrUnsummon();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -362,7 +359,7 @@ class mob_snobold_vassal : public CreatureScript
_instance->SetData(DATA_SNOBOLD_COUNT, DECREASE);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -377,7 +374,7 @@ class mob_snobold_vassal : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || _targetDied)
return;
@@ -484,7 +481,7 @@ class npc_firebomb : public CreatureScript
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (_instance->GetData(TYPE_NORTHREND_BEASTS) != GORMOK_IN_PROGRESS)
me->DespawnOrUnsummon();
@@ -561,7 +558,7 @@ struct boss_jormungarAI : public BossAI
instance->SetData(TYPE_NORTHREND_BEASTS, SNAKES_IN_PROGRESS);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -624,9 +621,9 @@ struct boss_jormungarAI : public BossAI
return;
}
}
- if (events.GetPhaseMask() & PHASE_MASK_MOBILE)
+ if (events.IsInPhase(PHASE_MOBILE))
DoMeleeAttackIfReady();
- if (events.GetPhaseMask() & PHASE_MASK_STATIONARY)
+ if (events.IsInPhase(PHASE_STATIONARY))
DoSpellAttackIfReady(SpitSpell);
}
@@ -807,7 +804,7 @@ class mob_slime_pool : public CreatureScript
me->SetReactState(REACT_PASSIVE);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!_cast)
{
@@ -975,7 +972,7 @@ class boss_icehowl : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 9b6f4a6a0da..b41e986741b 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -270,7 +270,7 @@ struct boss_twin_baseAI : public BossAI
DoCast(me, SurgeSpellId);
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -292,7 +292,7 @@ struct boss_twin_baseAI : public BossAI
me->UpdateDamagePhysical(mode ? OFF_ATTACK : BASE_ATTACK);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance || !UpdateVictim())
return;
@@ -594,7 +594,7 @@ class mob_unleashed_dark : public CreatureScript
{
mob_unleashed_darkAI(Creature* creature) : mob_unleashed_ballAI(creature) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (RangeCheckTimer < diff)
{
@@ -626,7 +626,7 @@ class mob_unleashed_light : public CreatureScript
{
mob_unleashed_lightAI(Creature* creature) : mob_unleashed_ballAI(creature) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (RangeCheckTimer < diff)
{
@@ -654,11 +654,11 @@ class mob_bullet_controller : public CreatureScript
public:
mob_bullet_controller() : CreatureScript("mob_bullet_controller") { }
- struct mob_bullet_controllerAI : public Scripted_NoMovementAI
+ struct mob_bullet_controllerAI : public ScriptedAI
{
- mob_bullet_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ mob_bullet_controllerAI(Creature* creature) : ScriptedAI(creature)
{
- Reset();
+ SetCombatMovement(false);
}
void Reset()
@@ -666,7 +666,7 @@ class mob_bullet_controller : public CreatureScript
DoCastAOE(SPELL_CONTROLLER_PERIODIC);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
UpdateVictim();
}
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 3e3fbf51cd0..a68ea1025d5 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
@@ -267,7 +267,7 @@ class boss_lich_king_toc : public CreatureScript
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!_instance)
return;
@@ -415,7 +415,7 @@ class npc_fizzlebang_toc : public CreatureScript
_summons.Summon(summoned);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!_instance)
return;
@@ -548,7 +548,7 @@ class npc_tirion_toc : public CreatureScript
void AttackStart(Unit* /*who*/) {}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!_instance)
return;
@@ -836,7 +836,7 @@ class npc_garrosh_toc : public CreatureScript
void AttackStart(Unit* /*who*/) {}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!_instance)
return;
@@ -920,7 +920,7 @@ class npc_varian_toc : public CreatureScript
void AttackStart(Unit* /*who*/) {}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!_instance)
return;
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
index 6cb970f6ab7..923f8a23d6f 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
@@ -86,7 +86,7 @@ class boss_dred : public CreatureScript
instance->SetData(DATA_DRED_EVENT, IN_PROGRESS);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -148,7 +148,7 @@ class boss_dred : public CreatureScript
DoMeleeAttackIfReady();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_RAPTOR_KILLED)
++raptorsKilled;
@@ -196,7 +196,7 @@ class npc_drakkari_gutripper : public CreatureScript
GutRipTimer = urand(10000, 15000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -246,7 +246,7 @@ class npc_drakkari_scytheclaw : public CreatureScript
uiRendTimer = urand(10000, 15000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
index e99128fbbf9..6eedfb357db 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -112,7 +112,7 @@ public:
DoStartNoMovement(target);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || _bubbled)
return;
@@ -141,7 +141,7 @@ public:
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_CRYSTAL_HANDLER_DIED)
CrystalHandlerDied();
@@ -279,7 +279,7 @@ public:
_temp = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_spell)
{
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
index 1f30b805f8a..0ca7ccd196a 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
@@ -107,7 +107,7 @@ public:
instance->SetData(DATA_THARON_JA_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
index bcec5fc1547..9e9ecc561d5 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -108,7 +108,7 @@ public:
instance->SetData(DATA_TROLLGORE_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
index 261eb854aa3..516a3e0f7c9 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
@@ -118,7 +118,7 @@ class boss_bronjahm : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
{
- if (events.GetPhaseMask() & (1 << PHASE_1) && !HealthAbovePct(30))
+ if (events.IsInPhase(PHASE_1) && !HealthAbovePct(30))
{
events.SetPhase(PHASE_2);
DoCast(me, SPELL_TELEPORT);
@@ -136,7 +136,7 @@ class boss_bronjahm : public CreatureScript
summon->CastSpell(summon, SPELL_PURPLE_BANISH_VISUAL, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 b3781f89e06..623124f441f 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
@@ -247,7 +247,7 @@ class boss_devourer_of_souls : public CreatureScript
return 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// Return since we have no target
if (!UpdateVictim())
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 b5d95dfb0f6..efc687eb409 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
@@ -95,7 +95,7 @@ public:
phase = PHASE_NORMAL;
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
switch (actionId)
{
@@ -109,7 +109,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (phase == PHASE_INTRO)
{
@@ -221,7 +221,7 @@ public:
phase = PHASE_NORMAL;
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
switch (actionId)
{
@@ -235,7 +235,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (phase == PHASE_INTRO)
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
index 2278bfe409a..5e13fd22c47 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
@@ -95,7 +95,7 @@ public:
Talk(SAY_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
index 1d7e405585f..191465a52f3 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
@@ -91,7 +91,7 @@ public:
Talk(SAY_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// Return since we have no target
if (!UpdateVictim())
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 e0a2f90b082..c6093d6bc0f 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -233,7 +233,7 @@ public:
me->SetVisible(true);
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
switch (actionId)
{
@@ -246,7 +246,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
switch (events.ExecuteEvent())
@@ -657,7 +657,7 @@ public:
events.ScheduleEvent(EVENT_DARK_MENDING, 20000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -740,7 +740,7 @@ public:
events.ScheduleEvent(EVENT_HALLUCINATION, 40000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -840,7 +840,7 @@ public:
events.ScheduleEvent(EVENT_KIDNEY_SHOT, 12000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -910,7 +910,7 @@ public:
events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -976,7 +976,7 @@ public:
events.ScheduleEvent(EVENT_ICE_SHOT, 15000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 a8bd92cc070..2cab1cca214 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
@@ -102,7 +102,7 @@ struct boss_horAI : ScriptedAI
uiDamage = 0;
}
- void DoAction(const int32 actionID)
+ void DoAction(int32 actionID)
{
switch (actionID)
{
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 160d45f5140..822adbb9201 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
@@ -52,11 +52,7 @@ enum Phases
{
PHASE_ONE = 1,
PHASE_TWO = 2,
- PHASE_THREE = 3,
-
- PHASE_ONE_MASK = 1 << PHASE_ONE,
- PHASE_TWO_MASK = 1 << PHASE_TWO,
- PHASE_THREE_MASK = 1 << PHASE_THREE,
+ PHASE_THREE = 3
};
enum MiscData
@@ -136,7 +132,7 @@ enum Events
void DamageTaken(Unit* /*attacker*/, uint32& /*uiDamage*/)
{
- if (events.GetPhaseMask() & PHASE_ONE_MASK && !HealthAbovePct(66))
+ if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(66))
{
events.SetPhase(PHASE_TWO);
Talk(SAY_PHASE2);
@@ -146,7 +142,7 @@ enum Events
return;
}
- if (events.GetPhaseMask() & PHASE_TWO_MASK && !HealthAbovePct(33))
+ if (events.IsInPhase(PHASE_TWO) && !HealthAbovePct(33))
{
events.SetPhase(PHASE_THREE);
Talk(SAY_PHASE3);
@@ -162,12 +158,12 @@ enum Events
if (type != EFFECT_MOTION_TYPE || id != POINT_FORGE)
return;
- if (events.GetPhaseMask() & PHASE_TWO_MASK)
+ if (events.IsInPhase(PHASE_TWO))
{
DoCast(me, SPELL_FORGE_BLADE);
SetEquipmentSlots(false, EQUIP_ID_SWORD);
}
- if (events.GetPhaseMask() & PHASE_THREE_MASK)
+ if (events.IsInPhase(PHASE_THREE))
{
me->RemoveAurasDueToSpell(SPELL_FORGE_BLADE_HELPER);
DoCast(me, SPELL_FORGE_MACE);
@@ -190,7 +186,7 @@ enum Events
return _permafrostStack;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -226,15 +222,15 @@ enum Events
break;
case EVENT_JUMP:
me->AttackStop();
- if (events.GetPhaseMask() & PHASE_TWO_MASK)
+ if (events.IsInPhase(PHASE_TWO))
me->GetMotionMaster()->MoveJump(northForgePos.GetPositionX(), northForgePos.GetPositionY(), northForgePos.GetPositionZ(), 25.0f, 15.0f);
- else if (events.GetPhaseMask() & PHASE_THREE_MASK)
+ else if (events.IsInPhase(PHASE_THREE))
me->GetMotionMaster()->MoveJump(southForgePos.GetPositionX(), southForgePos.GetPositionY(), southForgePos.GetPositionZ(), 25.0f, 15.0f);
break;
case EVENT_RESUME_ATTACK:
- if (events.GetPhaseMask() & PHASE_TWO_MASK)
+ if (events.IsInPhase(PHASE_THREE))
events.ScheduleEvent(EVENT_CHILLING_WAVE, 5000, 0, PHASE_TWO);
- else if (events.GetPhaseMask() & PHASE_THREE_MASK)
+ else if (events.IsInPhase(PHASE_THREE))
events.ScheduleEvent(EVENT_DEEP_FREEZE, 10000, 0, PHASE_THREE);
AttackStart(me->getVictim());
break;
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index f657c8e19b5..182f79b6ea0 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -203,7 +203,7 @@ class boss_ick : public CreatureScript
me->AddThreat(target, _tempThreat);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat())
return;
@@ -338,7 +338,7 @@ class boss_krick : public CreatureScript
}
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
if (actionId == ACTION_OUTRO)
{
@@ -365,7 +365,7 @@ class boss_krick : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_1, 1000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_phase != PHASE_OUTRO)
return;
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 783cc266509..8b771f507c2 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
@@ -94,7 +94,7 @@ enum Phases
PHASE_NONE = 0,
PHASE_INTRO = 1,
PHASE_COMBAT = 2,
- PHASE_OUTRO = 3,
+ PHASE_OUTRO = 3
};
enum Actions
@@ -168,7 +168,7 @@ class boss_tyrannus : public CreatureScript
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
- if (victim && me->Attack(victim, true) && !(events.GetPhaseMask() & (1 << PHASE_INTRO)))
+ if (victim && me->Attack(victim, true) && !events.IsInPhase(PHASE_INTRO))
me->GetMotionMaster()->MoveChase(victim);
}
@@ -201,7 +201,7 @@ class boss_tyrannus : public CreatureScript
rimefang->AI()->DoAction(ACTION_END_COMBAT);
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
if (actionId == ACTION_START_INTRO)
{
@@ -215,9 +215,9 @@ class boss_tyrannus : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
- if (!UpdateVictim() && !(events.GetPhaseMask() & (1 << PHASE_INTRO)))
+ if (!UpdateVictim() && !events.IsInPhase(PHASE_INTRO))
return;
events.Update(diff);
@@ -313,7 +313,7 @@ class boss_rimefang : public CreatureScript
_vehicle->InstallAllAccessories(false);
}
- void DoAction(const int32 actionId)
+ void DoAction(int32 actionId)
{
if (actionId == ACTION_START_RIMEFANG)
{
@@ -335,9 +335,9 @@ class boss_rimefang : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
- if (!UpdateVictim() && !(_events.GetPhaseMask() & (1 << PHASE_COMBAT)))
+ if (!UpdateVictim() && !_events.IsInPhase(PHASE_COMBAT))
return;
_events.Update(diff);
@@ -409,7 +409,7 @@ class player_overlord_brandAI : public PlayerAI
me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth*5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID());
}
- void UpdateAI(const uint32 /*diff*/) { }
+ void UpdateAI(uint32 /*diff*/) { }
private:
Creature* tyrannus;
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 246d389e0e7..42d912e2bd2 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
@@ -60,7 +60,7 @@ class mob_ymirjar_flamebearer : public CreatureScript
_events.ScheduleEvent(EVENT_TACTICAL_BLINK, 15000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -125,7 +125,7 @@ class mob_iceborn_protodrake : public CreatureScript
_vehicle->RemoveAllPassengers();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -178,7 +178,7 @@ class mob_geist_ambusher : public CreatureScript
DoCast(who, SPELL_LEAPING_FACE_MAUL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index 58301df4ca2..1ec29224763 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -140,7 +140,7 @@ class boss_drakkari_colossus : public CreatureScript
instance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, FAIL);
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -148,6 +148,7 @@ class boss_drakkari_colossus : public CreatureScript
DoCast(SPELL_EMERGE);
break;
case ACTION_FREEZE_COLOSSUS:
+ me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->SetReactState(REACT_PASSIVE);
@@ -207,7 +208,7 @@ class boss_drakkari_colossus : public CreatureScript
introDone = data;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -284,7 +285,7 @@ class boss_drakkari_elemental : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -310,7 +311,7 @@ class boss_drakkari_elemental : public CreatureScript
DoMeleeAttackIfReady();
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -465,7 +466,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
index d169fb163b2..df949c7a962 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
@@ -75,7 +75,7 @@ public:
instance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
index baba9d5396b..e4cdf89c165 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
@@ -127,7 +127,7 @@ public:
instance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
index 8f325dafc82..97c75b5f391 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
@@ -91,7 +91,7 @@ public:
instance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
index 1b5f6e5d426..6deb0c20676 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
@@ -122,7 +122,7 @@ public:
instance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -231,7 +231,7 @@ public:
uiGripOfSladRanTimer = 1*IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -286,7 +286,7 @@ public:
uiVenomousBiteTimer = 2*IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 cb073b1c569..833649b576d 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -282,7 +282,7 @@ class boss_blood_council_controller : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -477,7 +477,7 @@ class boss_prince_keleseth_icc : public CreatureScript
Talk(SAY_KELESETH_KILL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -522,7 +522,7 @@ class boss_prince_keleseth_icc : public CreatureScript
return true;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckRoom())
return;
@@ -695,7 +695,7 @@ class boss_prince_taldaram_icc : public CreatureScript
Talk(SAY_TALDARAM_KILL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -740,7 +740,7 @@ class boss_prince_taldaram_icc : public CreatureScript
return true;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckRoom())
return;
@@ -933,7 +933,7 @@ class boss_prince_valanar_icc : public CreatureScript
Talk(SAY_VALANAR_KILL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -978,7 +978,7 @@ class boss_prince_valanar_icc : public CreatureScript
return true;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckRoom())
return;
@@ -1090,7 +1090,7 @@ class npc_blood_queen_lana_thel : public CreatureScript
me->SetVisible(false);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!_events.GetPhaseMask())
return;
@@ -1168,7 +1168,7 @@ class npc_ball_of_flame : public CreatureScript
_chaseGUID = guid;
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_FLAME_BALL_CHASE)
if (Player* target = ObjectAccessor::GetPlayer(*me, _chaseGUID))
@@ -1189,7 +1189,7 @@ class npc_ball_of_flame : public CreatureScript
_instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, uint32(false));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!_despawnTimer)
return;
@@ -1236,7 +1236,7 @@ class npc_kinetic_bomb : public CreatureScript
_groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == SPELL_KINETIC_BOMB_EXPLOSION)
_events.ScheduleEvent(EVENT_BOMB_DESPAWN, 1000);
@@ -1248,7 +1248,7 @@ class npc_kinetic_bomb : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
_events.Update(diff);
@@ -1328,7 +1328,7 @@ class npc_dark_nucleus : public CreatureScript
me->AddThreat(attacker, 500000000.0f);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 ab0c44aa6d0..f4df90c49e8 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
@@ -45,11 +45,13 @@ 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 = 71952,
+ SPELL_PRESENCE_OF_THE_DARKFALLEN = 70994,
+ SPELL_PRESENCE_OF_THE_DARKFALLEN_2 = 71952,
SPELL_BLOOD_MIRROR_DAMAGE = 70821,
SPELL_BLOOD_MIRROR_VISUAL = 71510,
SPELL_BLOOD_MIRROR_DUMMY = 70838,
@@ -88,6 +90,7 @@ uint32 const vampireAuras[3][MAX_DIFFICULTY] =
#define ESSENCE_OF_BLOOD_QUEEN_PLR RAID_MODE<uint32>(70879, 71525, 71530, 71531)
#define FRENZIED_BLOODTHIRST RAID_MODE<uint32>(70877, 71474, 70877, 71474)
#define DELIRIOUS_SLASH RAID_MODE<uint32>(71623, 71624, 71625, 71626)
+#define PRESENCE_OF_THE_DARKFALLEN RAID_MODE<uint32>(70994, 71962, 71963, 71964)
enum Events
{
@@ -220,9 +223,10 @@ class boss_blood_queen_lana_thel : public CreatureScript
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY);
instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN);
+ instance->DoRemoveAurasDueToSpellOnPlayers(PRESENCE_OF_THE_DARKFALLEN);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action != ACTION_KILL_MINCHAR)
return;
@@ -330,7 +334,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -357,8 +361,11 @@ class boss_blood_queen_lana_thel : public CreatureScript
{
Unit* target = targets.front();
DoCast(target, SPELL_VAMPIRIC_BITE);
+ DoCastAOE(SPELL_VAMPIRIC_BITE_DUMMY, true);
Talk(SAY_VAMPIRIC_BITE);
_vampires.insert(target->GetGUID());
+ target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN, TRIGGERED_FULL_MASK);
+ target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN_2, TRIGGERED_FULL_MASK);
}
break;
}
@@ -377,9 +384,10 @@ class boss_blood_queen_lana_thel : public CreatureScript
_offtank->CastSpell(me->getVictim(), SPELL_BLOOD_MIRROR_DAMAGE, true);
me->getVictim()->CastSpell(_offtank, SPELL_BLOOD_MIRROR_DUMMY, true);
DoCastVictim(SPELL_BLOOD_MIRROR_VISUAL);
- if (Item* shadowsEdge = _offtank->GetWeaponForAttack(BASE_ATTACK, true))
- if (!_offtank->HasAura(SPELL_THIRST_QUENCHED) && shadowsEdge->GetEntry() == ITEM_SHADOW_S_EDGE && !_offtank->HasAura(SPELL_GUSHING_WOUND))
- _offtank->CastSpell(_offtank, SPELL_GUSHING_WOUND, true);
+ if (Is25ManRaid() && _offtank->GetQuestStatus(QUEST_BLOOD_INFUSION) == QUEST_STATUS_INCOMPLETE &&
+ _offtank->HasAura(SPELL_UNSATED_CRAVING) && !_offtank->HasAura(SPELL_THIRST_QUENCHED) &&
+ !_offtank->HasAura(SPELL_GUSHING_WOUND))
+ _offtank->CastSpell(_offtank, SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK);
}
}
@@ -396,13 +404,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
{
std::list<Player*> targets;
SelectRandomTarget(false, &targets);
- uint32 targetCount = 2;
- // do not combine these checks! we want it incremented TWICE when both conditions are met
- if (IsHeroic())
- ++targetCount;
- if (Is25ManRaid())
- ++targetCount;
- Trinity::Containers::RandomResizeList<Player*>(targets, targetCount);
+ Trinity::Containers::RandomResizeList(targets, Is25ManRaid() ? 3 : 2);
if (targets.size() > 1)
{
Talk(SAY_PACT_OF_THE_DARKFALLEN);
@@ -479,7 +481,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
if (Unit* refTarget = (*itr)->getTarget())
- if (refTarget != me->getVictim() && refTarget->GetTypeId() == TYPEID_PLAYER && (includeOfftank ? true : (refTarget != _offtank)))
+ if (refTarget != me->getVictim() && refTarget->GetTypeId() == TYPEID_PLAYER && (includeOfftank || (refTarget != _offtank)))
tempTargets.push_back(refTarget->ToPlayer());
if (tempTargets.empty())
@@ -554,33 +556,36 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
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, true);
- // Presence of the Darkfallen buff on Blood-Queen
- if (GetCaster()->GetMap()->IsHeroic())
- GetCaster()->CastSpell(GetCaster(), SPELL_PRESENCE_OF_THE_DARKFALLEN, true);
+ GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK);
+
// Shadowmourne questline
- if (GetCaster()->ToPlayer()->GetQuestStatus(QUEST_BLOOD_INFUSION) == QUEST_STATUS_INCOMPLETE)
+ if (Aura* aura = GetCaster()->GetAura(SPELL_GUSHING_WOUND))
{
- if (Aura* aura = GetCaster()->GetAura(SPELL_GUSHING_WOUND))
+ if (aura->GetStackAmount() == 3)
{
- if (aura->GetStackAmount() == 3)
- {
- GetCaster()->CastSpell(GetCaster(), SPELL_THIRST_QUENCHED, true);
- GetCaster()->RemoveAura(aura);
- }
- else
- GetCaster()->CastSpell(GetCaster(), SPELL_GUSHING_WOUND, true);
+ GetCaster()->CastSpell(GetCaster(), SPELL_THIRST_QUENCHED, TRIGGERED_FULL_MASK);
+ GetCaster()->RemoveAura(aura);
}
+ else
+ 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);
}
+ void HandlePresence(SpellEffIndex /*effIndex*/)
+ {
+ GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN, TRIGGERED_FULL_MASK);
+ GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_2, 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);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index d688205938a..fe135ea70a4 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -185,9 +185,7 @@ enum Phases
{
PHASE_INTRO_A = 1,
PHASE_INTRO_H = 2,
- PHASE_COMBAT = 3,
-
- PHASE_INTRO_MASK = (1 << PHASE_INTRO_A) | (1 << PHASE_INTRO_H),
+ PHASE_COMBAT = 3
};
enum Actions
@@ -415,16 +413,16 @@ class boss_deathbringer_saurfang : public CreatureScript
}
}
- void SpellHit(Unit* caster, SpellInfo const* spell)
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
{
if (spell->Id == SPELL_BLOOD_LINK_POWER)
if (Aura* bloodPower = me->GetAura(SPELL_BLOOD_POWER))
bloodPower->RecalculateAmountOfEffects();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if (!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
+ if (!UpdateVictim() && !(events.IsInPhase(PHASE_INTRO_A) || events.IsInPhase(PHASE_INTRO_H)))
return;
events.Update(diff);
@@ -514,7 +512,7 @@ class boss_deathbringer_saurfang : public CreatureScript
}
// intro setup
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -605,14 +603,14 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
_events.Reset();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
case ACTION_START_EVENT:
{
// Prevent crashes
- if (_events.GetPhaseMask() & PHASE_INTRO_MASK)
+ if (_events.IsInPhase(PHASE_INTRO_A) || _events.IsInPhase(PHASE_INTRO_H))
return;
GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_KOR_KRON_REAVER, 20.0f);
@@ -710,7 +708,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
@@ -814,14 +812,14 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
_events.Reset();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
case ACTION_START_EVENT:
{
// Prevent crashes
- if (_events.GetPhaseMask() & PHASE_INTRO_MASK)
+ if (_events.IsInPhase(PHASE_INTRO_A) || _events.IsInPhase(PHASE_INTRO_H))
return;
_events.SetPhase(PHASE_INTRO_A);
@@ -890,7 +888,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
@@ -972,7 +970,7 @@ class npc_saurfang_event : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_CHARGE && _index)
me->GetMotionMaster()->MoveCharge(chargePos[_index].GetPositionX(), chargePos[_index].GetPositionY(), chargePos[_index].GetPositionZ(), 13.0f, POINT_CHARGE);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
index 70cb585422d..4ec945fcb77 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -162,7 +162,7 @@ class boss_festergut : public CreatureScript
target->RemoveAurasDueToSpell(INOCULATED_HELPER);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -298,7 +298,7 @@ class npc_stinky_icc : public CreatureScript
DoCast(me, SPELL_PLAGUE_STENCH);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index 4e677bf5b0e..59c9393c934 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -160,10 +160,7 @@ enum Phases
PHASE_ALL = 0,
PHASE_INTRO = 1,
PHASE_ONE = 2,
- PHASE_TWO = 3,
-
- PHASE_INTRO_MASK = 1 << PHASE_INTRO,
- PHASE_ONE_MASK = 1 << PHASE_ONE,
+ PHASE_TWO = 3
};
enum DeprogrammingData
@@ -259,7 +256,7 @@ class boss_lady_deathwhisper : public CreatureScript
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
- if (victim && me->Attack(victim, true) && !(events.GetPhaseMask() & PHASE_ONE_MASK))
+ if (victim && me->Attack(victim, true) && !events.IsInPhase(PHASE_ONE))
me->GetMotionMaster()->MoveChase(victim);
}
@@ -358,7 +355,7 @@ class boss_lady_deathwhisper : public CreatureScript
void DamageTaken(Unit* /*damageDealer*/, uint32& damage)
{
// phase transition
- if (events.GetPhaseMask() & PHASE_ONE_MASK && damage > me->GetPower(POWER_MANA))
+ if (events.IsInPhase(PHASE_ONE) && damage > me->GetPower(POWER_MANA))
{
Talk(SAY_PHASE_2);
Talk(EMOTE_PHASE_2);
@@ -404,14 +401,14 @@ class boss_lady_deathwhisper : public CreatureScript
summon->CastSpell(summon, SPELL_ADHERENT_S_DETERMINATION, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) || !CheckInRoom())
+ if ((!UpdateVictim() && !events.IsInPhase(PHASE_INTRO)) || !CheckInRoom())
return;
events.Update(diff);
- if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK))
+ if (me->HasUnitState(UNIT_STATE_CASTING) && !events.IsInPhase(PHASE_INTRO))
return;
while (uint32 eventId = events.ExecuteEvent())
@@ -659,7 +656,7 @@ class npc_cult_fanatic : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -737,7 +734,7 @@ class npc_cult_adherent : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -882,7 +879,7 @@ class npc_darnavan : public CreatureScript
Talk(SAY_DARNAVAN_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 4763896cf72..7e72ad00a3c 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -20,8 +20,9 @@
#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "MapManager.h"
-#include "icecrown_citadel.h"
+#include "MoveSplineInit.h"
#include "Player.h"
+#include "icecrown_citadel.h"
enum ScriptTexts
{
@@ -78,7 +79,46 @@ enum MovementPoints
POINT_TARGET_COLDFLAME = 36672631,
};
-#define DATA_COLDFLAME_GUID 0
+enum MiscInfo
+{
+ DATA_COLDFLAME_GUID = 0,
+
+ // Manual marking for targets hit by Bone Slice as no aura exists for this purpose
+ // These units are the tanks in this encounter
+ // and should be immune to Bone Spike Graveyard
+ DATA_SPIKE_IMMUNE = 1,
+ //DATA_SPIKE_IMMUNE_1, = 2, // Reserved & used
+ //DATA_SPIKE_IMMUNE_2, = 3, // Reserved & used
+
+ ACTION_CLEAR_SPIKE_IMMUNITIES = 1,
+
+ MAX_BONE_SPIKE_IMMUNE = 3,
+};
+
+class BoneSpikeTargetSelector : public std::unary_function<Unit*, bool>
+{
+ public:
+ BoneSpikeTargetSelector(UnitAI* ai) : _ai(ai) { }
+
+ bool operator()(Unit* unit) const
+ {
+ if (unit->GetTypeId() != TYPEID_PLAYER)
+ return false;
+
+ if (unit->HasAura(SPELL_IMPALED))
+ return false;
+
+ // Check if it is one of the tanks soaking Bone Slice
+ for (uint32 i = 0; i < MAX_BONE_SPIKE_IMMUNE; ++i)
+ if (unit->GetGUID() == _ai->GetGUID(DATA_SPIKE_IMMUNE + i))
+ return false;
+
+ return true;
+ }
+
+ private:
+ UnitAI* _ai;
+};
class boss_lord_marrowgar : public CreatureScript
{
@@ -103,11 +143,12 @@ class boss_lord_marrowgar : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_BONE_STORM);
me->RemoveAurasDueToSpell(SPELL_BERSERK);
events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000);
- events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(10000, 15000), EVENT_GROUP_SPECIAL);
+ events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, 15000, EVENT_GROUP_SPECIAL);
events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL);
events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(45000, 50000));
events.ScheduleEvent(EVENT_ENRAGE, 600000);
_boneSlice = false;
+ _boneSpikeImmune.clear();
}
void EnterCombat(Unit* /*who*/)
@@ -148,7 +189,7 @@ class boss_lord_marrowgar : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -199,18 +240,18 @@ class boss_lord_marrowgar : public CreatureScript
if (!unit)
unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
if (unit)
- me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
+ me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, *unit);
break;
}
case EVENT_BONE_STORM_END:
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired();
- DoStartMovement(me->getVictim());
+ me->GetMotionMaster()->MoveChase(me->getVictim());
me->SetSpeed(MOVE_RUN, _baseSpeed, true);
events.CancelEvent(EVENT_BONE_STORM_MOVE);
events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000);
if (!IsHeroic())
- events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL);
+ events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, 15000, EVENT_GROUP_SPECIAL);
break;
case EVENT_ENABLE_BONE_SLICE:
_boneSlice = true;
@@ -239,7 +280,7 @@ class boss_lord_marrowgar : public CreatureScript
return;
// lock movement
- DoStartNoMovement(me->getVictim());
+ me->GetMotionMaster()->MoveIdle();
}
Position const* GetLastColdflamePosition() const
@@ -247,23 +288,51 @@ class boss_lord_marrowgar : public CreatureScript
return &_coldflameLastPos;
}
- uint64 GetGUID(int32 type/* = 0 */) const
+ uint64 GetGUID(int32 type /*= 0 */) const
{
- if (type == DATA_COLDFLAME_GUID)
- return _coldflameTarget;
+ switch (type)
+ {
+ case DATA_COLDFLAME_GUID:
+ return _coldflameTarget;
+ case DATA_SPIKE_IMMUNE + 0:
+ case DATA_SPIKE_IMMUNE + 1:
+ case DATA_SPIKE_IMMUNE + 2:
+ {
+ uint32 index = uint32(type - DATA_SPIKE_IMMUNE);
+ if (index < _boneSpikeImmune.size())
+ return _boneSpikeImmune[index];
+
+ break;
+ }
+ }
+
return 0LL;
}
- void SetGUID(uint64 guid, int32 type/* = 0 */)
+ void SetGUID(uint64 guid, int32 type /*= 0 */)
+ {
+ switch (type)
+ {
+ case DATA_COLDFLAME_GUID:
+ _coldflameTarget = guid;
+ break;
+ case DATA_SPIKE_IMMUNE:
+ _boneSpikeImmune.push_back(guid);
+ break;
+ }
+ }
+
+ void DoAction(int32 action)
{
- if (type != DATA_COLDFLAME_GUID)
+ if (action != ACTION_CLEAR_SPIKE_IMMUNITIES)
return;
- _coldflameTarget = guid;
+ _boneSpikeImmune.clear();
}
private:
Position _coldflameLastPos;
+ std::vector<uint64> _boneSpikeImmune;
uint64 _coldflameTarget;
uint32 _boneStormDuration;
float _baseSpeed;
@@ -295,19 +364,17 @@ class npc_coldflame : public CreatureScript
if (owner->GetTypeId() != TYPEID_UNIT)
return;
- Creature* creOwner = owner->ToCreature();
Position pos;
- // random target case
+ if (MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, owner->GetAI()))
+ pos.Relocate(marrowgarAI->GetLastColdflamePosition());
+ else
+ pos.Relocate(owner);
+
if (owner->HasAura(SPELL_BONE_STORM))
{
- if (MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, creOwner->AI()))
- {
- Position const* ownerPos = marrowgarAI->GetLastColdflamePosition();
- float ang = me->GetAngle(ownerPos) - static_cast<float>(M_PI);
- MapManager::NormalizeOrientation(ang);
- me->SetOrientation(ang);
- owner->GetNearPosition(pos, 2.5f, 0.0f);
- }
+ float ang = MapManager::NormalizeOrientation(pos.GetAngle(me));
+ me->SetOrientation(ang);
+ owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetObjectSize(), ang);
}
else
{
@@ -318,25 +385,27 @@ class npc_coldflame : public CreatureScript
return;
}
- me->SetOrientation(owner->GetAngle(target));
- owner->GetNearPosition(pos, owner->GetObjectSize() / 2.0f, 0.0f);
+ float ang = MapManager::NormalizeOrientation(pos.GetAngle(target));
+ me->SetOrientation(ang);
+ owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetObjectSize(), ang);
}
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
- _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 450);
+ DoCast(SPELL_COLDFLAME_SUMMON);
+ _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
_events.Update(diff);
if (_events.ExecuteEvent() == EVENT_COLDFLAME_TRIGGER)
{
Position newPos;
- me->GetNearPosition(newPos, 5.5f, 0.0f);
+ me->GetNearPosition(newPos, 5.0f, 0.0f);
me->NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
DoCast(SPELL_COLDFLAME_SUMMON);
- _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 450);
+ _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
}
}
@@ -355,11 +424,13 @@ class npc_bone_spike : public CreatureScript
public:
npc_bone_spike() : CreatureScript("npc_bone_spike") { }
- struct npc_bone_spikeAI : public Scripted_NoMovementAI
+ struct npc_bone_spikeAI : public ScriptedAI
{
- npc_bone_spikeAI(Creature* creature) : Scripted_NoMovementAI(creature), _hasTrappedUnit(false)
+ npc_bone_spikeAI(Creature* creature) : ScriptedAI(creature), _hasTrappedUnit(false)
{
ASSERT(creature->GetVehicleKit());
+
+ SetCombatMovement(false);
}
void JustDied(Unit* /*killer*/)
@@ -385,7 +456,25 @@ class npc_bone_spike : public CreatureScript
_hasTrappedUnit = true;
}
- void UpdateAI(uint32 const diff)
+ void PassengerBoarded(Unit* passenger, int8 /*seat*/, bool apply)
+ {
+ if (!apply)
+ return;
+
+ /// @HACK - Change passenger offset to the one taken directly from sniffs
+ /// Remove this when proper calculations are implemented.
+ /// This fixes healing spiked people
+ Movement::MoveSplineInit init(passenger);
+ init.DisableTransportPathTransformations();
+ init.MoveTo(-0.02206125f, -0.02132235f, 5.514783f, false);
+ init.Launch();
+
+ /// @WORKAROUND - Clear ON VEHICLE state to allow healing (Invalid target errors)
+ /// Current rule for applying this state is questionable (seatFlags & VEHICLE_SEAT_FLAG_ALLOW_TURNING ???)
+ passenger->ClearUnitState(UNIT_STATE_ONVEHICLE);
+ }
+
+ void UpdateAI(uint32 diff)
{
if (!_hasTrappedUnit)
return;
@@ -487,16 +576,24 @@ class spell_marrowgar_coldflame_damage : public SpellScriptLoader
{
PrepareAuraScript(spell_marrowgar_coldflame_damage_AuraScript);
- void OnPeriodic(AuraEffect const* /*aurEff*/)
+ bool CanBeAppliedOn(Unit* target)
{
- if (DynamicObject* owner = GetDynobjOwner())
- if (GetTarget()->GetExactDist2d(owner) >= owner->GetRadius() || GetTarget()->HasAura(SPELL_IMPALED))
- PreventDefaultAction();
+ if (target->HasAura(SPELL_IMPALED))
+ return false;
+
+ if (target->GetExactDist2d(GetOwner()) > GetSpellInfo()->Effects[EFFECT_0].CalcRadius())
+ return false;
+
+ if (Aura* aur = target->GetAura(GetId()))
+ if (aur->GetOwner() != GetOwner())
+ return false;
+
+ return true;
}
void Register()
{
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_marrowgar_coldflame_damage_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_marrowgar_coldflame_damage_AuraScript::CanBeAppliedOn);
}
};
@@ -531,7 +628,7 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
SpellCastResult CheckCast()
{
- return GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 0.0f, true, -SPELL_IMPALED) ? SPELL_CAST_OK : SPELL_FAILED_NO_VALID_TARGETS;
+ return GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, BoneSpikeTargetSelector(GetCaster()->GetAI())) ? SPELL_CAST_OK : SPELL_FAILED_NO_VALID_TARGETS;
}
void HandleSpikes(SpellEffIndex effIndex)
@@ -539,22 +636,22 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
PreventHitDefaultEffect(effIndex);
if (Creature* marrowgar = GetCaster()->ToCreature())
{
- bool didHit = false;
CreatureAI* marrowgarAI = marrowgar->AI();
uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
- for (uint8 i = 0; i < boneSpikeCount; ++i)
- {
- // select any unit but not the tank
- Unit* target = marrowgarAI->SelectTarget(SELECT_TARGET_RANDOM, 1, 150.0f, true, -SPELL_IMPALED);
- if (!target)
- break;
- didHit = true;
+ std::list<Unit*> targets;
+ marrowgarAI->SelectTargetList(targets, BoneSpikeTargetSelector(marrowgarAI), boneSpikeCount, SELECT_TARGET_RANDOM);
+ if (targets.empty())
+ return;
+
+ uint32 i = 0;
+ for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr, ++i)
+ {
+ Unit* target = *itr;
target->CastCustomSpell(BoneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true);
}
- if (didHit)
- marrowgarAI->Talk(SAY_BONESPIKE);
+ marrowgarAI->Talk(SAY_BONESPIKE);
}
}
@@ -597,6 +694,58 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader
}
};
+class spell_marrowgar_bone_slice : public SpellScriptLoader
+{
+ public:
+ spell_marrowgar_bone_slice() : SpellScriptLoader("spell_marrowgar_bone_slice") { }
+
+ class spell_marrowgar_bone_slice_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_marrowgar_bone_slice_SpellScript);
+
+ bool Load()
+ {
+ _targetCount = 0;
+ return true;
+ }
+
+ void ClearSpikeImmunities()
+ {
+ GetCaster()->GetAI()->DoAction(ACTION_CLEAR_SPIKE_IMMUNITIES);
+ }
+
+ void CountTargets(std::list<WorldObject*>& targets)
+ {
+ _targetCount = std::min<uint32>(targets.size(), GetSpellInfo()->MaxAffectedTargets);
+ }
+
+ void SplitDamage()
+ {
+ // Mark the unit as hit, even if the spell missed or was dodged/parried
+ GetCaster()->GetAI()->SetGUID(GetHitUnit()->GetGUID(), DATA_SPIKE_IMMUNE);
+
+ if (!_targetCount)
+ return; // This spell can miss all targets
+
+ SetHitDamage(GetHitDamage() / _targetCount);
+ }
+
+ void Register()
+ {
+ BeforeCast += SpellCastFn(spell_marrowgar_bone_slice_SpellScript::ClearSpikeImmunities);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_bone_slice_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnHit += SpellHitFn(spell_marrowgar_bone_slice_SpellScript::SplitDamage);
+ }
+
+ uint32 _targetCount;
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_marrowgar_bone_slice_SpellScript();
+ }
+};
+
void AddSC_boss_lord_marrowgar()
{
new boss_lord_marrowgar();
@@ -607,4 +756,5 @@ void AddSC_boss_lord_marrowgar()
new spell_marrowgar_coldflame_damage();
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 05bf7b9794a..e377f5f8d07 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -145,10 +145,7 @@ enum Phases
PHASE_ROTFACE = 2,
PHASE_COMBAT_1 = 4,
PHASE_COMBAT_2 = 5,
- PHASE_COMBAT_3 = 6,
-
- PHASE_MASK_COMBAT = (1 << PHASE_COMBAT_1) | (1 << PHASE_COMBAT_2) | (1 << PHASE_COMBAT_3),
- PHASE_MASK_NOT_SELF = (1 << PHASE_FESTERGUT) | (1 << PHASE_ROTFACE)
+ PHASE_COMBAT_3 = 6
};
enum Points
@@ -233,7 +230,7 @@ class boss_professor_putricide : public CreatureScript
void Reset()
{
- if (!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF))
+ if (!(events.IsInPhase(PHASE_ROTFACE) || events.IsInPhase(PHASE_FESTERGUT)))
instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, NOT_STARTED);
instance->SetData(DATA_NAUSEA_ACHIEVEMENT, uint32(true));
@@ -252,7 +249,7 @@ class boss_professor_putricide : public CreatureScript
void EnterCombat(Unit* who)
{
- if (events.GetPhaseMask() & PHASE_MASK_NOT_SELF)
+ if (events.IsInPhase(PHASE_ROTFACE) || events.IsInPhase(PHASE_FESTERGUT))
return;
if (!instance->CheckRequiredBosses(DATA_PROFESSOR_PUTRICIDE, who->ToPlayer()))
@@ -282,7 +279,7 @@ class boss_professor_putricide : public CreatureScript
{
_JustReachedHome();
me->SetWalk(false);
- if (events.GetPhaseMask() & PHASE_MASK_COMBAT)
+ if (events.IsInPhase(PHASE_COMBAT_1) || events.IsInPhase(PHASE_COMBAT_2) || events.IsInPhase(PHASE_COMBAT_3))
instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, FAIL);
}
@@ -416,7 +413,7 @@ class boss_professor_putricide : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -566,9 +563,9 @@ class boss_professor_putricide : public CreatureScript
_experimentState = bool(data);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if ((!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF) && !UpdateVictim()) || !CheckInRoom())
+ if ((!(events.IsInPhase(PHASE_ROTFACE) || events.IsInPhase(PHASE_FESTERGUT)) && !UpdateVictim()) || !CheckInRoom())
return;
events.Update(diff);
@@ -745,7 +742,7 @@ class npc_putricide_oozeAI : public ScriptedAI
_newTargetSelectTimer = 1000;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() && !_newTargetSelectTimer)
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index db5f373a753..f398ad55603 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -162,7 +162,7 @@ class boss_rotface : public CreatureScript
// don't enter combat
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -239,7 +239,7 @@ class npc_little_ooze : public CreatureScript
me->DespawnOrUnsummon();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -296,13 +296,13 @@ class npc_big_ooze : public CreatureScript
me->DespawnOrUnsummon();
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
if (action == EVENT_STICKY_OOZE)
events.CancelEvent(EVENT_STICKY_OOZE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -377,7 +377,7 @@ class npc_precious_icc : public CreatureScript
rotface->AI()->Talk(SAY_PRECIOUS_DIES);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index 45c5302bfe8..ea74d8ec61c 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -84,7 +84,9 @@ enum Spells
SPELL_CONCUSSIVE_SHOCK = 71337,
// Frost Infusion
- SPELL_FROST_INFUSION_CREDIT = 72289
+ SPELL_FROST_INFUSION_CREDIT = 72289,
+ SPELL_FROST_IMBUED_BLADE = 72290,
+ SPELL_FROST_INFUSION = 72292,
};
enum Events
@@ -147,11 +149,7 @@ enum MovementPoints
enum Shadowmourne
{
- QUEST_FROST_INFUSION = 24757,
- ITEM_SHADOW_S_EDGE = 49888,
-
- SPELL_FROST_INFUSION = 72292,
- SPELL_FROST_IMBUED_BLADE = 72290,
+ QUEST_FROST_INFUSION = 24757
};
Position const RimefangFlyPos = {4413.309f, 2456.421f, 233.3795f, 2.890186f};
@@ -271,7 +269,7 @@ class boss_sindragosa : public CreatureScript
Talk(SAY_KILL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_START_FROSTWYRM)
{
@@ -390,50 +388,13 @@ class boss_sindragosa : public CreatureScript
void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me))
- {
if (spellId == spell->Id)
- {
if (Aura const* mysticBuffet = target->GetAura(spell->Id))
_mysticBuffetStack = std::max<uint8>(_mysticBuffetStack, mysticBuffet->GetStackAmount());
- return;
- }
- }
-
- // Frost Infusion
- if (Player* player = target->ToPlayer())
- {
- if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(_isThirdPhase ? SPELL_FROST_BREATH_P2 : SPELL_FROST_BREATH_P1, me))
- {
- if (spellId == spell->Id)
- {
- Item* shadowsEdge = player->GetWeaponForAttack(BASE_ATTACK, true);
- if (player->GetQuestStatus(QUEST_FROST_INFUSION) == QUEST_STATUS_INCOMPLETE && shadowsEdge)
- {
- if (!player->HasAura(SPELL_FROST_IMBUED_BLADE) && shadowsEdge->GetEntry() == ITEM_SHADOW_S_EDGE)
- {
- if (Aura* infusion = player->GetAura(SPELL_FROST_INFUSION))
- {
- if (infusion->GetStackAmount() == 3)
- {
- player->CastSpell(player, SPELL_FROST_IMBUED_BLADE, true);
- player->RemoveAura(infusion);
- }
- else
- player->CastSpell(player, SPELL_FROST_INFUSION, true);
- }
- else
- player->CastSpell(player, SPELL_FROST_INFUSION, true);
- }
- }
-
- return;
- }
- }
- }
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -576,11 +537,12 @@ class npc_ice_tomb : public CreatureScript
public:
npc_ice_tomb() : CreatureScript("npc_ice_tomb") { }
- struct npc_ice_tombAI : public Scripted_NoMovementAI
+ struct npc_ice_tombAI : public ScriptedAI
{
- npc_ice_tombAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_ice_tombAI(Creature* creature) : ScriptedAI(creature)
{
_trappedPlayerGUID = 0;
+ SetCombatMovement(false);
}
void Reset()
@@ -597,7 +559,7 @@ class npc_ice_tomb : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_TRIGGER_ASPHYXIATION)
if (Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID))
@@ -616,7 +578,7 @@ class npc_ice_tomb : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!_trappedPlayerGUID)
return;
@@ -695,7 +657,7 @@ class npc_spinestalker : public CreatureScript
_events.Reset();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_START_FROSTWYRM)
{
@@ -732,7 +694,7 @@ class npc_spinestalker : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -825,7 +787,7 @@ class npc_rimefang : public CreatureScript
_events.Reset();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_START_FROSTWYRM)
{
@@ -867,7 +829,7 @@ class npc_rimefang : public CreatureScript
DoCast(me, SPELL_FROST_AURA_RIMEFANG, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -995,7 +957,7 @@ class npc_sindragosa_trash : public CreatureScript
return 0;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1154,6 +1116,50 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
}
};
+class spell_sindragosa_frost_breath : public SpellScriptLoader
+{
+ public:
+ spell_sindragosa_frost_breath() : SpellScriptLoader("spell_sindragosa_frost_breath") { }
+
+ class spell_sindragosa_frost_breath_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_sindragosa_frost_breath_SpellScript);
+
+ void HandleInfusion()
+ {
+ Player* target = GetHitPlayer();
+ if (!target)
+ return;
+
+ if (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;
+
+ 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);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_sindragosa_frost_breath_SpellScript();
+ }
+};
+
class spell_sindragosa_instability : public SpellScriptLoader
{
public:
@@ -1576,6 +1582,7 @@ void AddSC_boss_sindragosa()
new npc_sindragosa_trash();
new spell_sindragosa_s_fury();
new spell_sindragosa_unchained_magic();
+ new spell_sindragosa_frost_breath();
new spell_sindragosa_instability();
new spell_sindragosa_frost_beacon();
new spell_sindragosa_ice_tomb();
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 3bd313fa148..e314667d48a 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -279,20 +279,10 @@ enum Phases
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_INTRO = 1 << PHASE_INTRO,
- PHASE_MASK_ONE = 1 << PHASE_ONE,
- PHASE_MASK_TWO = 1 << PHASE_TWO,
- PHASE_MASK_THREE = 1 << PHASE_THREE,
- PHASE_MASK_TRANSITION = 1 << PHASE_TRANSITION,
- PHASE_MASK_NO_CAST_CHECK = (1 << PHASE_TRANSITION) | (1 << PHASE_FROSTMOURNE) | (1 << PHASE_OUTRO),
- PHASE_MASK_FROSTMOURNE = 1 << PHASE_FROSTMOURNE,
- PHASE_MASK_OUTRO = 1 << PHASE_OUTRO,
- PHASE_MASK_NO_VICTIM = (1 << PHASE_INTRO) | (1 << PHASE_OUTRO) | (1 << PHASE_FROSTMOURNE),
+ PHASE_OUTRO = 7
};
-#define PHASE_TWO_THREE (events.GetPhaseMask() & PHASE_MASK_TWO ? PHASE_TWO : PHASE_THREE)
+#define PHASE_TWO_THREE (events.IsInPhase(PHASE_TWO) ? PHASE_TWO : PHASE_THREE)
Position const CenterPosition = {503.6282f, -2124.655f, 840.8569f, 0.0f};
Position const TirionIntro = {489.2970f, -2124.840f, 840.8569f, 0.0f};
@@ -589,11 +579,11 @@ class boss_the_lich_king : public CreatureScript
void KilledUnit(Unit* victim)
{
- if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && !(events.GetPhaseMask() & PHASE_MASK_OUTRO))
+ if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && !events.IsInPhase(PHASE_OUTRO))
Talk(SAY_LK_KILL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -669,7 +659,7 @@ class boss_the_lich_king : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
{
- if (events.GetPhaseMask() & PHASE_MASK_ONE && !HealthAbovePct(70))
+ if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(70))
{
events.SetPhase(PHASE_TRANSITION);
me->SetReactState(REACT_PASSIVE);
@@ -678,7 +668,7 @@ class boss_the_lich_king : public CreatureScript
return;
}
- if (events.GetPhaseMask() & PHASE_MASK_TWO && !HealthAbovePct(40))
+ if (events.IsInPhase(PHASE_TWO) && !HealthAbovePct(40))
{
events.SetPhase(PHASE_TRANSITION);
me->SetReactState(REACT_PASSIVE);
@@ -687,7 +677,7 @@ class boss_the_lich_king : public CreatureScript
return;
}
- if (events.GetPhaseMask() & PHASE_MASK_THREE && !HealthAbovePct(10))
+ if (events.IsInPhase(PHASE_THREE) && !HealthAbovePct(10))
{
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
@@ -758,7 +748,7 @@ class boss_the_lich_king : public CreatureScript
summon->SetReactState(REACT_PASSIVE);
summon->SetSpeed(MOVE_FLIGHT, 0.5f);
summon->GetMotionMaster()->MoveRandom(10.0f);
- if (!(events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE))
+ if (!events.IsInPhase(PHASE_FROSTMOURNE))
summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000));
return;
}
@@ -870,17 +860,17 @@ class boss_the_lich_king : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// check phase first to prevent updating victim and entering evade mode when not wanted
- if (!(events.GetPhaseMask() & PHASE_MASK_NO_VICTIM))
+ if (!(events.IsInPhase(PHASE_OUTRO) || events.IsInPhase(PHASE_INTRO) || events.IsInPhase(PHASE_FROSTMOURNE)))
if (!UpdateVictim())
return;
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) && !(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK))
+ if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.IsInPhase(PHASE_TRANSITION) || events.IsInPhase(PHASE_OUTRO) || events.IsInPhase(PHASE_FROSTMOURNE)))
return;
while (uint32 eventId = events.ExecuteEvent())
@@ -936,7 +926,7 @@ class boss_the_lich_king : public CreatureScript
break;
case EVENT_INFEST:
DoCast(me, SPELL_INFEST);
- events.ScheduleEvent(EVENT_INFEST, urand(21000, 24000), 0, (events.GetPhaseMask() & PHASE_MASK_ONE) ? PHASE_ONE : PHASE_TWO);
+ events.ScheduleEvent(EVENT_INFEST, urand(21000, 24000), 0, events.IsInPhase(PHASE_ONE) ? PHASE_ONE : PHASE_TWO);
break;
case EVENT_NECROTIC_PLAGUE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, NecroticPlagueTargetCheck(me, NECROTIC_PLAGUE_LK, NECROTIC_PLAGUE_PLR)))
@@ -1005,7 +995,7 @@ class boss_the_lich_king : public CreatureScript
break;
case EVENT_START_ATTACK:
me->SetReactState(REACT_AGGRESSIVE);
- if (events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE)
+ if (events.IsInPhase(PHASE_FROSTMOURNE))
events.SetPhase(PHASE_THREE);
break;
case EVENT_VILE_SPIRITS:
@@ -1204,7 +1194,7 @@ class npc_tirion_fordring_tft : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -1251,9 +1241,9 @@ class npc_tirion_fordring_tft : public CreatureScript
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if (!UpdateVictim() && !(_events.GetPhaseMask() & (PHASE_MASK_INTRO | PHASE_MASK_OUTRO)))
+ if (!UpdateVictim() && !(_events.IsInPhase(PHASE_OUTRO) || _events.IsInPhase(PHASE_INTRO)))
return;
_events.Update(diff);
@@ -1345,7 +1335,7 @@ class npc_shambling_horror_icc : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1425,7 +1415,7 @@ class npc_raging_spirit : public CreatureScript
summon->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1560,7 +1550,7 @@ class npc_valkyr_shadowguard : public CreatureScript
_grabbedPlayer = guid;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1635,7 +1625,7 @@ class npc_strangulate_vehicle : public CreatureScript
lichKing->AI()->JustSummoned(me);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action != ACTION_TELEPORT_BACK)
return;
@@ -1653,7 +1643,7 @@ class npc_strangulate_vehicle : public CreatureScript
lichKing->AI()->SummonedCreatureDespawn(me);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
UpdateVictim();
@@ -1734,7 +1724,7 @@ class npc_terenas_menethil : public CreatureScript
return target->GetEntry() != NPC_THE_LICH_KING;
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -1803,7 +1793,7 @@ class npc_terenas_menethil : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_2, 14000, 0, PHASE_OUTRO);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
UpdateVictim();
@@ -1895,7 +1885,7 @@ class npc_spirit_warden : public CreatureScript
terenas->AI()->DoAction(ACTION_TELEPORT_BACK);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1963,7 +1953,7 @@ class npc_spirit_bomb : public CreatureScript
{
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
UpdateVictim();
// no melee attacks
@@ -1998,7 +1988,7 @@ class npc_broken_frostmourne : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_KNOCK_BACK, 3000, 0, PHASE_OUTRO);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_SUMMON_TERENAS)
_events.ScheduleEvent(EVENT_OUTRO_SUMMON_TERENAS, 6000, 0, PHASE_OUTRO);
@@ -2008,7 +1998,7 @@ class npc_broken_frostmourne : public CreatureScript
{
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
UpdateVictim();
@@ -2188,7 +2178,8 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
- caster->GetAI()->SetData(DATA_PLAGUE_STACK, GetStackAmount());
+ if (caster->GetAI())
+ caster->GetAI()->SetData(DATA_PLAGUE_STACK, GetStackAmount());
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -2847,8 +2838,6 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
-
- Unit* _target;
};
SpellScript* GetSpellScript() const
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index df23abd8312..97a70f43c27 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -316,7 +316,7 @@ class boss_valithria_dreamwalker : public CreatureScript
{
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action != ACTION_ENTER_COMBAT)
return;
@@ -423,7 +423,7 @@ class boss_valithria_dreamwalker : public CreatureScript
++_missedPortals;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// does not enter combat
if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS)
@@ -536,7 +536,7 @@ class npc_green_dragon_combat_trigger : public CreatureScript
DoAction(ACTION_DEATH);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_DEATH)
{
@@ -545,7 +545,7 @@ class npc_green_dragon_combat_trigger : public CreatureScript
}
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!me->isInCombat())
return;
@@ -624,7 +624,7 @@ class npc_the_lich_king_controller : public CreatureScript
summon->AI()->AttackStart(target);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -716,7 +716,7 @@ class npc_risen_archmage : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action != ACTION_ENTER_COMBAT)
return;
@@ -734,7 +734,7 @@ class npc_risen_archmage : public CreatureScript
summon->DespawnOrUnsummon(36000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat())
if (me->GetDBTableGUIDLow())
@@ -805,7 +805,7 @@ class npc_blazing_skeleton : public CreatureScript
_events.ScheduleEvent(EVENT_LEY_WASTE, urand(15000, 20000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -871,7 +871,7 @@ class npc_suppresser : public CreatureScript
AttackStart(valithria);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -928,7 +928,7 @@ class npc_blistering_zombie : public CreatureScript
DoCast(me, SPELL_ACID_BURST, true);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -965,7 +965,7 @@ class npc_gluttonous_abomination : public CreatureScript
DoCast(me, SPELL_ROT_WORM_SPAWNER, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1024,7 +1024,7 @@ class npc_dream_portal : public CreatureScript
return (type == MISSED_PORTALS && _used) ? 0 : 1;
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
UpdateVictim();
}
@@ -1059,7 +1059,7 @@ class npc_dream_cloud : public CreatureScript
me->LoadCreaturesAddon(true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// trigger
if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS)
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 12868094b2e..3ffa6a0c4be 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -460,7 +460,7 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (_damnedKills != 2)
return;
@@ -611,7 +611,7 @@ class npc_rotting_frost_giant : public CreatureScript
_events.Reset();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -664,13 +664,14 @@ class npc_frost_freeze_trap : public CreatureScript
public:
npc_frost_freeze_trap() : CreatureScript("npc_frost_freeze_trap") { }
- struct npc_frost_freeze_trapAI: public Scripted_NoMovementAI
+ struct npc_frost_freeze_trapAI: public ScriptedAI
{
- npc_frost_freeze_trapAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_frost_freeze_trapAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -683,7 +684,7 @@ class npc_frost_freeze_trap : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
_events.Update(diff);
@@ -807,7 +808,7 @@ class boss_sister_svalna : public CreatureScript
me->SetHover(false);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -876,7 +877,7 @@ class boss_sister_svalna : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() && !_isEventInProgress)
return;
@@ -955,7 +956,7 @@ class npc_crok_scourgebane : public CreatureScript
_wipeCheckTimer = 1000;
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_START_GAUNTLET)
{
@@ -1237,7 +1238,7 @@ struct npc_argent_captainAI : public ScriptedAI
Talk(SAY_CAPTAIN_KILL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_START_GAUNTLET)
{
@@ -1355,7 +1356,7 @@ class npc_captain_arnath : public CreatureScript
Events.ScheduleEvent(EVENT_ARNATH_DOMINATE_MIND, urand(22000, 27000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1436,7 +1437,7 @@ class npc_captain_brandon : public CreatureScript
Events.ScheduleEvent(EVENT_BRANDON_HAMMER_OF_BETRAYAL, urand(25000, 30000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1504,7 +1505,7 @@ class npc_captain_grondel : public CreatureScript
Events.ScheduleEvent(EVENT_GRONDEL_CONFLAGRATION, urand(12000, 17000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1569,7 +1570,7 @@ class npc_captain_rupert : public CreatureScript
Events.ScheduleEvent(EVENT_RUPERT_ROCKET_LAUNCH, urand(10000, 15000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1654,7 +1655,7 @@ class npc_impaling_spear : public CreatureScript
_vehicleCheckTimer = 500;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (_vehicleCheckTimer <= diff)
{
@@ -1695,7 +1696,7 @@ class npc_arthas_teleport_visual : public CreatureScript
_events.ScheduleEvent(EVENT_SOUL_MISSILE, urand(1000, 6000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (_events.Empty())
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
index 1407568686f..887a31baf9a 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
@@ -56,6 +56,7 @@ enum SharedSpells
SPELL_FROSTMOURNE_TELEPORT_VISUAL = 73078,
// Shadowmourne questline
+ SPELL_UNSATED_CRAVING = 71168,
SPELL_SHADOWS_FATE = 71169
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index 462708360e3..db4ab2f32d2 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -435,7 +435,7 @@ class instance_icecrown_citadel : public InstanceMapScript
// these 2 gates are functional only on 25man modes
case GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_01:
case GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_04:
- if (instance->GetSpawnMode() & 1)
+ if (instance->Is25ManRaid())
AddDoor(go, true);
break;
case GO_LADY_DEATHWHISPER_ELEVATOR:
@@ -954,7 +954,7 @@ class instance_icecrown_citadel : public InstanceMapScript
bool CheckRequiredBosses(uint32 bossId, Player const* player = NULL) const
{
- if (player && AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()))
+ if (player && player->GetSession()->HasPermission(RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES))
return true;
switch (bossId)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
index 14e2d05a7c1..d4b16594bc8 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
@@ -144,7 +144,7 @@ public:
summon->CastSpell(summon, SPELL_SUMMON_CORPSE_SCARABS_MOB, true, NULL, NULL, me->GetGUID());
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
index 4d5efe4e89c..35f23db24f7 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -122,7 +122,7 @@ class boss_faerlina : public CreatureScript
return 0;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index e037f627bee..9013b051b9a 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -326,7 +326,7 @@ public:
events.ScheduleEvent(EVENT_BERSERK, 15*100*1000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (nextWP && movementStarted && !movementCompleted && !nextMovementStarted)
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index c735107968a..723b2538fc8 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -93,7 +93,7 @@ public:
summons.Summon(summon);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictimWithGaze() || !CheckInRoom())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 21f3141393a..451992b1d91 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -393,7 +393,7 @@ class boss_gothik : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -524,7 +524,7 @@ class mob_gothik_minion : public CreatureScript
return (liveSide == IN_LIVE_SIDE(who));
}
- void DoAction(int32 const param)
+ void DoAction(int32 param)
{
gateClose = param;
}
@@ -574,7 +574,7 @@ class mob_gothik_minion : public CreatureScript
Reset();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (gateClose && (!isOnSameSide(me) || (me->getVictim() && !isOnSameSide(me->getVictim()))))
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
index 536c2af2bd8..3e44fe9eba4 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
@@ -78,7 +78,7 @@ public: boss_grobbulus() : CreatureScript("boss_grobbulus") { }
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -125,11 +125,11 @@ public:
return new npc_grobbulus_poison_cloudAI(creature);
}
- struct npc_grobbulus_poison_cloudAI : public Scripted_NoMovementAI
+ struct npc_grobbulus_poison_cloudAI : public ScriptedAI
{
- npc_grobbulus_poison_cloudAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_grobbulus_poison_cloudAI(Creature* creature) : ScriptedAI(creature)
{
- Reset();
+ SetCombatMovement(false);
}
uint32 Cloud_Timer;
@@ -140,7 +140,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Cloud_Timer <= diff)
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index c88ac807421..ec2335df8e1 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -133,7 +133,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 1b34e2a93a7..1ee32c8a36e 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -382,7 +382,7 @@ public:
KTTriggerGUID = instance ? instance->GetData64(DATA_KELTHUZAD_TRIGGER) : 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -735,7 +735,7 @@ class npc_kelthuzad_abomination : public CreatureScript
DoCast(me, SPELL_FRENZY, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
index 75fe66b9faf..3664a166a9f 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
@@ -93,7 +93,7 @@ class boss_loatheb : public CreatureScript
return uint32(_sporeLoserData);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index 28def13a0d2..dfac6049875 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -85,7 +85,7 @@ public:
events.ScheduleEvent(EVENT_SUMMON, 30000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
index 89b65615a2e..d0034628424 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
@@ -145,7 +145,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
index e77a9708ba5..13a5340fa8e 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
@@ -98,7 +98,7 @@ public:
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
index 52dfd60f5f8..0829ecb094d 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
@@ -99,7 +99,7 @@ public:
events.ScheduleEvent(EVENT_KNIFE, 10000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index cd68d7ecac3..878107ab35d 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -159,7 +159,7 @@ class boss_sapphiron : public CreatureScript
events.ScheduleEvent(EVENT_LIFTOFF, 0);
}
- void DoAction(int32 const param)
+ void DoAction(int32 param)
{
if (param == DATA_SAPPHIRON_BIRTH)
{
@@ -217,7 +217,7 @@ class boss_sapphiron : public CreatureScript
return 0;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!_phase)
return;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
index 6c09e7156fe..ea50c67ad1c 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -159,7 +159,7 @@ public:
Talk(SAY_DEATH);
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -218,7 +218,7 @@ public:
return uint32(polaritySwitch);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (checkFeugenAlive && checkStalaggAlive)
uiAddsTimer = 0;
@@ -331,7 +331,7 @@ public:
pThaddius->AI()->DoAction(ACTION_STALAGG_DIED);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -423,7 +423,7 @@ public:
pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 1be93dcbaa5..b0a34047c0e 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -501,7 +501,7 @@ public:
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -771,7 +771,7 @@ public:
}
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
// When duration of oppened riff visual ends,
// closed one should be cast
@@ -841,7 +841,7 @@ public:
}
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!_instance)
return;
@@ -941,7 +941,7 @@ public:
// we dont evade
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (me->GetEntry() != NPC_HOVER_DISK_CASTER)
return;
@@ -1010,7 +1010,7 @@ public:
DoCast(me, SPELL_ARCANE_OVERLOAD, false);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
// we dont do melee damage!
}
@@ -1066,7 +1066,7 @@ public:
_events.ScheduleEvent(EVENT_YELL_1, 0);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
while (uint32 eventId = _events.ExecuteEvent())
{
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
index 955c6b801af..8d1420ce12e 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
@@ -124,7 +124,7 @@ class boss_anomalus : public CreatureScript
chaosTheory = false;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -191,11 +191,12 @@ class mob_chaotic_rift : public CreatureScript
public:
mob_chaotic_rift() : CreatureScript("mob_chaotic_rift") { }
- struct mob_chaotic_riftAI : public Scripted_NoMovementAI
+ struct mob_chaotic_riftAI : public ScriptedAI
{
- mob_chaotic_riftAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ mob_chaotic_riftAI(Creature* creature) : ScriptedAI(creature)
{
instance = me->GetInstanceScript();
+ SetCombatMovement(false);
}
InstanceScript* instance;
@@ -211,7 +212,7 @@ class mob_chaotic_rift : public CreatureScript
DoCast(me, SPELL_ARCANEFORM, false);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_kolurg.cpp
index fedb1f5cebc..7f32b2bc4a5 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_kolurg.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_kolurg.cpp
@@ -56,7 +56,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard.cpp
index 39c93f15d6f..e257b898426 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard.cpp
@@ -53,7 +53,7 @@ public:
void Reset() {}
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
index d1a9227c6fb..8c06895f08f 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
@@ -167,7 +167,7 @@ public:
intenseColdList.push_back(guid);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 7679ae53c80..26bf80cb32e 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -140,7 +140,7 @@ public:
Talk(SAY_KILL);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_MAGUS_DEAD)
{
@@ -213,7 +213,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
index c9cfe70b8de..0f480b1d101 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
@@ -109,7 +109,7 @@ public:
Talk(SAY_KILL);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -219,7 +219,7 @@ public:
return type == DATA_COUNT ? _count : 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_despawntimer <= diff)
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
index feb801450b1..1a820cd3727 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
@@ -81,7 +81,7 @@ public:
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -170,7 +170,7 @@ public:
deathTimer = 19000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (pulseTimer <= diff)
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
index 0af498f24c6..d27909328a5 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -141,7 +141,7 @@ public:
return 0;
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
if (action != ACTION_SET_NORMAL_EVENTS)
return;
@@ -194,7 +194,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index 07f19ce9760..57a9c9958df 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -240,7 +240,7 @@ public:
Talk(SAY_PLAYER_KILL);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index ec240db0b69..a2b5d340410 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -96,7 +96,7 @@ public:
return coreEnergizeOrientation;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -187,7 +187,7 @@ class npc_azure_ring_captain : public CreatureScript
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -207,7 +207,7 @@ class npc_azure_ring_captain : public CreatureScript
DoCast(target, SPELL_ICE_BEAM);
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
switch (action)
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
index f152d0011aa..1f8ba3edade 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
@@ -355,7 +355,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!(instance->GetBossState(DATA_VAROS_EVENT) == DONE))
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 16e705e45ab..6a16a644b5c 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -223,7 +223,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -412,7 +412,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index 6f017884063..9ce8ea3c52c 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -198,8 +198,7 @@ public:
summoned->CastSpell(summoned, DUNGEON_MODE(SPELL_SPARK_VISUAL_TRIGGER, H_SPELL_SPARK_VISUAL_TRIGGER), true);
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
summoned->SetInCombatWith(target);
summoned->GetMotionMaster()->Clear();
@@ -214,7 +213,7 @@ public:
lSparkList.Despawn(summoned);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -336,7 +335,7 @@ public:
uiDamage = 0;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
// Despawn if the encounter is not running
if (instance && instance->GetData(TYPE_IONAR) != IN_PROGRESS)
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
index df99ab33467..fe6c1c27155 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
@@ -123,7 +123,7 @@ public:
Talk(SAY_SLAY);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index 9b22003bb1c..1e41f346942 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -226,7 +226,7 @@ public:
return 0;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -427,7 +427,7 @@ public:
me->DespawnOrUnsummon();
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
// Return since we have no target or if we are frozen
if (!UpdateVictim() || m_bIsFrozen)
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
index c9a4d2ba5bd..e24ce570c5a 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
@@ -99,7 +99,7 @@ public:
instance->SetData(DATA_KRYSTALLUS_EVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 7fbf5f3ee79..71222aba88b 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
@@ -107,7 +107,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -117,9 +117,7 @@ public:
{
if (PartingSorrowTimer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
-
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_PARTING_SORROW);
PartingSorrowTimer = urand(30000, 40000);
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
index 9e4c97ea0fc..3b0faa08574 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
@@ -147,7 +147,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -228,7 +228,7 @@ public:
Talk(SAY_SLAY);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action == ACTION_OOZE_DEAD)
++abuseTheOoze;
@@ -266,7 +266,7 @@ public:
uiMergeTimer = 10000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiMergeTimer <= diff)
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
index f1d690f32e0..0a9ae889588 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
@@ -204,7 +204,7 @@ public:
}*/
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (bKaddrakActivated)
{
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 13a4fe23690..5a5efc36b3c 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
@@ -176,10 +176,7 @@ enum EncounterPhases
{
PHASE_NORMAL = 0,
PHASE_ROLE_PLAY = 1,
- PHASE_BIG_BANG = 2,
-
- PHASE_MASK_NO_UPDATE = (1 << PHASE_ROLE_PLAY) | (1 << PHASE_BIG_BANG),
- PHASE_MASK_NO_CAST_CHECK = 1 << PHASE_ROLE_PLAY,
+ PHASE_BIG_BANG = 2
};
enum AchievmentInfo
@@ -331,7 +328,7 @@ class boss_algalon_the_observer : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -344,7 +341,7 @@ class boss_algalon_the_observer : public CreatureScript
me->GetMotionMaster()->MovePoint(POINT_ALGALON_LAND, AlgalonLandPos);
me->SetHomePosition(AlgalonLandPos);
Movement::MoveSplineInit init(me);
- init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ());
+ init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ(), false);
init.SetOrientationFixed(true);
init.Launch();
events.Reset();
@@ -540,14 +537,14 @@ class boss_algalon_the_observer : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if ((!(events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) || !CheckInRoom())
+ if ((!(events.IsInPhase(PHASE_ROLE_PLAY) || events.IsInPhase(PHASE_BIG_BANG)) && !UpdateVictim()) || !CheckInRoom())
return;
events.Update(diff);
- if (!(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK))
+ if (!events.IsInPhase(PHASE_ROLE_PLAY))
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
@@ -733,7 +730,7 @@ class npc_living_constellation : public CreatureScript
return _isActive ? 1 : 0;
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -770,9 +767,9 @@ class npc_living_constellation : public CreatureScript
caster->ToCreature()->DespawnOrUnsummon(1);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
- if (!(_events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim())
+ if (!(_events.IsInPhase(PHASE_ROLE_PLAY) || _events.IsInPhase(PHASE_BIG_BANG)) && !UpdateVictim())
return;
_events.Update(diff);
@@ -864,7 +861,7 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
{
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -915,7 +912,7 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, delay);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
UpdateVictim();
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 451ad6ed915..6ad70d38635 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
@@ -158,7 +158,7 @@ class boss_steelbreaker : public CreatureScript
events.ScheduleEvent(EVENT_FUSION_PUNCH, 15000);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -212,7 +212,7 @@ class boss_steelbreaker : public CreatureScript
DoCast(me, SPELL_ELECTRICAL_CHARGE);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -287,7 +287,7 @@ class boss_runemaster_molgeim : public CreatureScript
events.ScheduleEvent(EVENT_RUNE_OF_POWER, 20000);
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -338,7 +338,7 @@ class boss_runemaster_molgeim : public CreatureScript
Talk(SAY_MOLGEIM_SLAY);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -440,7 +440,7 @@ class boss_stormcaller_brundir : public CreatureScript
events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 120000));
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -499,7 +499,7 @@ class boss_stormcaller_brundir : public CreatureScript
Talk(SAY_BRUNDIR_SLAY);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
index aa8c7a96898..5faa2cc4628 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
@@ -154,7 +154,7 @@ class boss_auriaya : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -207,7 +207,7 @@ class boss_auriaya : public CreatureScript
Talk(SAY_DEATH);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -299,7 +299,7 @@ class npc_auriaya_seeping_trigger : public CreatureScript
DoCast(me, SPELL_SEEPING_ESSENCE);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (instance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS)
me->DespawnOrUnsummon();
@@ -338,7 +338,7 @@ class npc_sanctum_sentry : public CreatureScript
DoCast(me, SPELL_STRENGHT_PACK, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -408,7 +408,7 @@ class npc_feral_defender : public CreatureScript
events.ScheduleEvent(EVENT_RUSH, 10000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 89ddbb7ac38..236791a4f6f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -362,7 +362,7 @@ class boss_flame_leviathan : public CreatureScript
Unbroken = data ? true : false;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -467,7 +467,7 @@ class boss_flame_leviathan : public CreatureScript
_pursueTarget = target->GetGUID();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (action && action <= 4) // Tower destruction, debuff leviathan loot and reduce active tower count
{
@@ -638,7 +638,7 @@ class boss_flame_leviathan_defense_cannon : public CreatureScript
DoCast(me, AURA_STEALTH_DETECTION);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -752,7 +752,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript
me->SetPosition(x, y, z, 0);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
}
};
@@ -802,7 +802,7 @@ class npc_mechanolift : public CreatureScript
container->EnterVehicle(me);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (MoveTimer <= diff)
{
@@ -851,7 +851,7 @@ class npc_pool_of_tar : public CreatureScript
me->CastSpell(me, SPELL_BLAZE, true);
}
- void UpdateAI(uint32 const /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
CreatureAI* GetAI(Creature* creature) const
@@ -880,7 +880,7 @@ class npc_colossus : public CreatureScript
instance->SetData(DATA_COLOSSUS, instance->GetData(DATA_COLOSSUS)+1);
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -917,7 +917,7 @@ class npc_thorims_hammer : public CreatureScript
}
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!me->HasAura(AURA_DUMMY_BLUE))
me->CastSpell(me, AURA_DUMMY_BLUE, true);
@@ -963,7 +963,7 @@ public:
uint32 infernoTimer;
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
@@ -1012,7 +1012,7 @@ class npc_hodirs_fury : public CreatureScript
}
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!me->HasAura(AURA_DUMMY_GREEN))
me->CastSpell(me, AURA_DUMMY_GREEN, true);
@@ -1046,7 +1046,7 @@ class npc_freyas_ward : public CreatureScript
summonTimer = 5000;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (summonTimer <= diff)
{
@@ -1089,7 +1089,7 @@ class npc_freya_ward_summon : public CreatureScript
lashTimer = 5000;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1127,7 +1127,7 @@ class npc_lorekeeper : public CreatureScript
{
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
// Start encounter
if (action == ACTION_SPAWN_VEHICLES)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index 4db3b58c53f..33a14aaa3df 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -216,10 +216,12 @@ class npc_iron_roots : public CreatureScript
public:
npc_iron_roots() : CreatureScript("npc_iron_roots") { }
- struct npc_iron_rootsAI : public Scripted_NoMovementAI
+ struct npc_iron_rootsAI : public ScriptedAI
{
- npc_iron_rootsAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_iron_rootsAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
+
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip
me->setFaction(14);
@@ -385,7 +387,7 @@ class boss_freya : public CreatureScript
return 0;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -720,7 +722,7 @@ class boss_elder_brightleaf : public CreatureScript
Talk(SAY_ELDER_AGGRO);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasAura(SPELL_DRAINED_OF_POWER))
return;
@@ -763,7 +765,7 @@ class boss_elder_brightleaf : public CreatureScript
DoMeleeAttackIfReady();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -854,7 +856,7 @@ class boss_elder_stonebark : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasAura(SPELL_DRAINED_OF_POWER))
return;
@@ -890,7 +892,7 @@ class boss_elder_stonebark : public CreatureScript
DoMeleeAttackIfReady();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -968,7 +970,7 @@ class boss_elder_ironbranch : public CreatureScript
Talk(SAY_ELDER_AGGRO);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasAura(SPELL_DRAINED_OF_POWER))
return;
@@ -1004,7 +1006,7 @@ class boss_elder_ironbranch : public CreatureScript
DoMeleeAttackIfReady();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -1049,7 +1051,7 @@ class npc_detonating_lasher : public CreatureScript
changeTargetTimer = 7500;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1108,7 +1110,7 @@ class npc_ancient_water_spirit : public CreatureScript
tidalWaveTimer = 10000;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1169,7 +1171,7 @@ class npc_storm_lasher : public CreatureScript
stormboltTimer = 5000;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1230,7 +1232,7 @@ class npc_snaplasher : public CreatureScript
waveCount = CAST_AI(boss_freya::boss_freyaAI, Freya->AI())->trioWaveCount;
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -1295,7 +1297,7 @@ class npc_ancient_conservator : public CreatureScript
DoCast(who, SPELL_CONSERVATOR_GRIP, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1337,10 +1339,11 @@ class npc_sun_beam : public CreatureScript
public:
npc_sun_beam() : CreatureScript("npc_sun_beam") { }
- struct npc_sun_beamAI : public Scripted_NoMovementAI
+ struct npc_sun_beamAI : public ScriptedAI
{
- npc_sun_beamAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_sun_beamAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
me->SetReactState(REACT_PASSIVE);
DoCastAOE(SPELL_FREYA_UNSTABLE_ENERGY_VISUAL, true);
DoCast(SPELL_FREYA_UNSTABLE_ENERGY);
@@ -1358,10 +1361,11 @@ class npc_healthy_spore : public CreatureScript
public:
npc_healthy_spore() : CreatureScript("npc_healthy_spore") { }
- struct npc_healthy_sporeAI : public Scripted_NoMovementAI
+ struct npc_healthy_sporeAI : public ScriptedAI
{
- npc_healthy_sporeAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_healthy_sporeAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->SetReactState(REACT_PASSIVE);
DoCast(me, SPELL_HEALTHY_SPORE_VISUAL);
@@ -1370,7 +1374,7 @@ class npc_healthy_spore : public CreatureScript
lifeTimer = urand(22000, 30000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (lifeTimer <= diff)
{
@@ -1397,17 +1401,19 @@ class npc_eonars_gift : public CreatureScript
public:
npc_eonars_gift() : CreatureScript("npc_eonars_gift") { }
- struct npc_eonars_giftAI : public Scripted_NoMovementAI
+ struct npc_eonars_giftAI : public ScriptedAI
{
- npc_eonars_giftAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_eonars_giftAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
+
lifeBindersGiftTimer = 12000;
DoCast(me, SPELL_GROW);
DoCast(me, SPELL_PHEROMONES, true);
DoCast(me, SPELL_EONAR_VISUAL, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (lifeBindersGiftTimer <= diff)
{
@@ -1435,15 +1441,17 @@ class npc_nature_bomb : public CreatureScript
public:
npc_nature_bomb() : CreatureScript("npc_nature_bomb") { }
- struct npc_nature_bombAI : public Scripted_NoMovementAI
+ struct npc_nature_bombAI : public ScriptedAI
{
- npc_nature_bombAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_nature_bombAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
+
bombTimer = urand(8000, 10000);
DoCast(SPELL_OBJECT_BOMB);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (bombTimer <= diff)
{
@@ -1475,10 +1483,12 @@ class npc_unstable_sun_beam : public CreatureScript
public:
npc_unstable_sun_beam() : CreatureScript("npc_unstable_sun_beam") { }
- struct npc_unstable_sun_beamAI : public Scripted_NoMovementAI
+ struct npc_unstable_sun_beamAI : public ScriptedAI
{
- npc_unstable_sun_beamAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_unstable_sun_beamAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
+
despawnTimer = urand(7000, 12000);
instance = me->GetInstanceScript();
DoCast(me, SPELL_PHOTOSYNTHESIS);
@@ -1486,7 +1496,7 @@ class npc_unstable_sun_beam : public CreatureScript
me->SetReactState(REACT_PASSIVE);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (despawnTimer <= diff)
{
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 6fa2c7127e6..1642cc0483f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -135,7 +135,7 @@ class boss_general_vezax : public CreatureScript
events.ScheduleEvent(EVENT_BERSERK, 600000);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -250,7 +250,7 @@ class boss_general_vezax : public CreatureScript
return 0;
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -333,7 +333,7 @@ class boss_saronite_animus : public CreatureScript
Vezax->AI()->DoAction(ACTION_ANIMUS_DIE);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -392,7 +392,7 @@ class npc_saronite_vapors : public CreatureScript
events.ScheduleEvent(EVENT_RANDOM_MOVE, urand(5000, 7500));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index 26d15d78e59..95ac326aa84 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -193,7 +193,7 @@ class npc_flash_freeze : public CreatureScript
checkDespawnTimer = 1000;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->getVictim()->HasAura(SPELL_BLOCK_OF_ICE) || me->getVictim()->HasAura(SPELL_FLASH_FREEZE_HELPER))
return;
@@ -381,7 +381,7 @@ class boss_hodir : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -460,7 +460,7 @@ class boss_hodir : public CreatureScript
DoMeleeAttackIfReady();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -525,7 +525,7 @@ class npc_icicle : public CreatureScript
icicleTimer = 2500;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (icicleTimer <= diff)
{
@@ -573,7 +573,7 @@ class npc_snowpacked_icicle : public CreatureScript
despawnTimer = 12000;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (despawnTimer <= diff)
{
@@ -611,7 +611,7 @@ class npc_hodir_priest : public CreatureScript
events.ScheduleEvent(EVENT_DISPEL_MAGIC, urand(15000, 20000));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED))
return;
@@ -687,7 +687,7 @@ class npc_hodir_shaman : public CreatureScript
events.ScheduleEvent(EVENT_STORM_CLOUD, urand(10000, 12500));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED))
return;
@@ -749,7 +749,7 @@ class npc_hodir_druid : public CreatureScript
events.ScheduleEvent(EVENT_STARLIGHT, urand(15000, 17500));
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED))
return;
@@ -824,7 +824,7 @@ class npc_hodir_mage : public CreatureScript
summons.remove(summoned->GetGUID());
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED))
return;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index f525bc874f7..b040a64c75a 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
@@ -180,7 +180,7 @@ class boss_ignis : public CreatureScript
summons.Summon(summon);
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
if (action != ACTION_REMOVE_BUFF)
return;
@@ -193,7 +193,7 @@ class boss_ignis : public CreatureScript
_firstConstructKill = secondKill;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -319,7 +319,7 @@ class npc_iron_construct : public CreatureScript
}
}
- void UpdateAI(const uint32 /*uiDiff*/)
+ void UpdateAI(uint32 /*uiDiff*/)
{
if (!UpdateVictim())
return;
@@ -392,7 +392,7 @@ class npc_scorch_ground : public CreatureScript
_heatTimer = 0;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (_heat)
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index 24282340278..94df327d3da 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -242,7 +242,7 @@ class boss_kologarn : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
index 79edede01df..b74c4109fd7 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
@@ -224,7 +224,7 @@ class boss_razorscale_controller : public CreatureScript
_JustDied();
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
if (instance->GetBossState(BOSS_RAZORSCALE) != IN_PROGRESS)
return;
@@ -243,7 +243,7 @@ class boss_razorscale_controller : public CreatureScript
}
}
- void UpdateAI(uint32 const Diff)
+ void UpdateAI(uint32 Diff)
{
events.Update(Diff);
@@ -394,7 +394,7 @@ class boss_razorscale : public CreatureScript
return 0;
}
- void UpdateAI(uint32 const Diff)
+ void UpdateAI(uint32 Diff)
{
if (!UpdateVictim())
return;
@@ -562,7 +562,7 @@ class boss_razorscale : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -625,7 +625,7 @@ class npc_expedition_commander : public CreatureScript
summons.push_back(summoned->GetGUID());
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -639,7 +639,7 @@ class npc_expedition_commander : public CreatureScript
}
}
- void UpdateAI(uint32 const Diff)
+ void UpdateAI(uint32 Diff)
{
if (AttackStartTimer <= Diff)
{
@@ -739,10 +739,11 @@ class npc_mole_machine_trigger : public CreatureScript
public:
npc_mole_machine_trigger() : CreatureScript("npc_mole_machine_trigger") { }
- struct npc_mole_machine_triggerAI : public Scripted_NoMovementAI
+ struct npc_mole_machine_triggerAI : public ScriptedAI
{
- npc_mole_machine_triggerAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_mole_machine_triggerAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED);
}
@@ -761,7 +762,7 @@ class npc_mole_machine_trigger : public CreatureScript
NpcSummoned = false;
}
- void UpdateAI(uint32 const Diff)
+ void UpdateAI(uint32 Diff)
{
if (!GobSummoned && SummonGobTimer <= Diff)
{
@@ -818,10 +819,11 @@ class npc_devouring_flame : public CreatureScript
public:
npc_devouring_flame() : CreatureScript("npc_devouring_flame") { }
- struct npc_devouring_flameAI : public Scripted_NoMovementAI
+ struct npc_devouring_flameAI : public ScriptedAI
{
- npc_devouring_flameAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_devouring_flameAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED);
}
@@ -855,7 +857,7 @@ class npc_darkrune_watcher : public CreatureScript
LightTimer = urand(1000, 3000);
}
- void UpdateAI(uint32 const Diff)
+ void UpdateAI(uint32 Diff)
{
if (!UpdateVictim())
return;
@@ -915,7 +917,7 @@ class npc_darkrune_guardian : public CreatureScript
}
- void UpdateAI(uint32 const Diff)
+ void UpdateAI(uint32 Diff)
{
if (!UpdateVictim())
return;
@@ -961,7 +963,7 @@ class npc_darkrune_sentinel : public CreatureScript
ShoutTimer = urand(15000, 30000);
}
- void UpdateAI(uint32 const Diff)
+ void UpdateAI(uint32 Diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
index 564087088d3..b75a6a67a30 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
@@ -78,7 +78,7 @@ class boss_thorim : public CreatureScript
_EnterCombat();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index 43d19d78f8a..a358fc41db0 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
@@ -241,7 +241,7 @@ class boss_xt002 : public CreatureScript
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MUST_DECONSTRUCT_FASTER);
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
switch (action)
{
@@ -269,7 +269,7 @@ class boss_xt002 : public CreatureScript
ExposeHeart();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || !CheckInRoom())
return;
@@ -451,14 +451,15 @@ class mob_xt002_heart : public CreatureScript
public:
mob_xt002_heart() : CreatureScript("mob_xt002_heart") { }
- struct mob_xt002_heartAI : public Scripted_NoMovementAI
+ struct mob_xt002_heartAI : public ScriptedAI
{
- mob_xt002_heartAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ mob_xt002_heartAI(Creature* creature) : ScriptedAI(creature),
_instance(creature->GetInstanceScript())
{
+ SetCombatMovement(false);
}
- void UpdateAI(uint32 const /*diff*/) { }
+ void UpdateAI(uint32 /*diff*/) { }
void JustDied(Unit* /*killer*/)
{
@@ -512,7 +513,7 @@ class mob_scrapbot : public CreatureScript
me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (_rangeCheckTimer <= diff)
{
@@ -573,7 +574,7 @@ class mob_pummeller : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -703,7 +704,7 @@ class mob_boombot : public CreatureScript
}
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -745,7 +746,7 @@ class mob_life_spark : public CreatureScript
_shockTimer = 0; // first one is immediate.
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index d3c174841ee..125f66497bf 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -565,10 +565,6 @@ class instance_ulduar : public InstanceMapScript
}
HandleGameObject(KologarnBridgeGUID, false);
}
- if (state == IN_PROGRESS)
- HandleGameObject(KologarnDoorGUID, false);
- else
- HandleGameObject(KologarnDoorGUID, true);
break;
case BOSS_HODIR:
if (state == DONE)
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 f579fb2b93c..215630ac5fa 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
@@ -154,7 +154,7 @@ public:
Talk(YELL_DEAD_1);
}
- if (events.GetPhaseMask() & (1 << PHASE_EVENT))
+ if (events.IsInPhase(PHASE_EVENT))
damage = 0;
}
@@ -204,9 +204,9 @@ public:
Talk(bIsUndead ? YELL_KILL_1 : YELL_KILL_2);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
- if (!UpdateVictim() && !(events.GetPhaseMask() & (1 << PHASE_EVENT)))
+ if (!UpdateVictim() && !events.IsInPhase(PHASE_EVENT))
return;
events.Update(diff);
@@ -358,7 +358,7 @@ public:
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiResurectTimer)
{
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
index 6e532a88396..896421909ad 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -94,7 +94,7 @@ public:
instance = creature->GetInstanceScript();
}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
void JustDied(Unit* /*killer*/)
{
@@ -193,7 +193,7 @@ public:
return 0;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -288,7 +288,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 05822aa2595..ef7ad659a24 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
@@ -180,7 +180,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (ghost)
{
@@ -340,7 +340,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (ghost)
{
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
index 7103095b252..4f7f0e844bb 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
@@ -146,7 +146,7 @@ public:
return near_f > 0 && near_f < 4 ? near_f : 0;
}
- void UpdateAI(uint32 const /* diff */)
+ void UpdateAI(uint32 /* diff */)
{
if (fm_Type == 0)
fm_Type = GetForgeMasterType();
@@ -291,7 +291,7 @@ public:
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
index 36506227287..2b1d850ab25 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
@@ -174,7 +174,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (currentPhase != PHASE_GORTOK_PALEHOOF)
return;
@@ -325,7 +325,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -438,7 +438,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -554,7 +554,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -674,7 +674,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -771,7 +771,7 @@ public:
me->SetSpeed(MOVE_FLIGHT, 0.5f);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (currentPhase == PHASE_NONE)
return;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 2514cb3de78..3a74eebd947 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -303,7 +303,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
switch (Phase)
{
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index dffdadc5b9c..f2090f6a2e6 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -250,7 +250,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Phase == IDLE)
return;
@@ -459,11 +459,13 @@ public:
return new npc_ritual_channelerAI(creature);
}
- struct npc_ritual_channelerAI : public Scripted_NoMovementAI
+ struct npc_ritual_channelerAI : public ScriptedAI
{
- npc_ritual_channelerAI(Creature* creature) :Scripted_NoMovementAI(creature)
+ npc_ritual_channelerAI(Creature* creature) :ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+
+ SetCombatMovement(false);
}
InstanceScript* instance;
@@ -477,7 +479,7 @@ public:
DoCast(me, SPELL_SHADOWS_IN_THE_DARK);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
@@ -599,7 +601,7 @@ class npc_scourge_hulk : public CreatureScript
killedByRitualStrike = true;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index 99d987e63a4..f4c65216f4a 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -207,7 +207,7 @@ public:
return 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (m_bIsWalking)
{
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
index 33e0619c7e5..a4ea8649ff9 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
@@ -76,7 +76,7 @@ class boss_archavon : public CreatureScript
}
// Below UpdateAI may need review/debug.
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -156,7 +156,7 @@ class mob_archavon_warder : public CreatureScript
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
index b8b6acce54d..baed96453dc 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
@@ -115,7 +115,7 @@ class boss_emalon : public CreatureScript
_EnterCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -215,7 +215,7 @@ class mob_tempest_minion : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
index fafeba6a570..50cb8f017b3 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
@@ -73,7 +73,7 @@ class boss_koralon : public CreatureScript
_EnterCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -149,7 +149,7 @@ class mob_flame_warder : public CreatureScript
events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 10000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 613b8ebf8dc..3068049e322 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
@@ -74,7 +74,7 @@ class boss_toravon : public CreatureScript
_EnterCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -142,7 +142,7 @@ class mob_frost_warder : public CreatureScript
events.ScheduleEvent(EVENT_FROST_BLAST, 5000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -196,7 +196,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!done)
{
@@ -234,9 +234,9 @@ class mob_frozen_orb_stalker : public CreatureScript
public:
mob_frozen_orb_stalker() : CreatureScript("mob_frozen_orb_stalker") { }
- struct mob_frozen_orb_stalkerAI : public Scripted_NoMovementAI
+ struct mob_frozen_orb_stalkerAI : public ScriptedAI
{
- mob_frozen_orb_stalkerAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ mob_frozen_orb_stalkerAI(Creature* creature) : ScriptedAI(creature)
{
creature->SetVisible(false);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE);
@@ -244,9 +244,11 @@ class mob_frozen_orb_stalker : public CreatureScript
instance = creature->GetInstanceScript();
spawned = false;
+
+ SetCombatMovement(false);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (spawned)
return;
diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
index 1f12685a4b0..d524e3fb708 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
@@ -89,7 +89,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance && instance->GetData(DATA_REMOVE_NPC) == 1)
{
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 6c16bb98ff1..9dbb10be601 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -144,7 +144,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -303,7 +303,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index fb4297f595f..364602f8fa1 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -151,7 +151,7 @@ public:
}
}
- void DoAction(const int32 param)
+ void DoAction(int32 param)
{
if (!me->isAlive())
return;
@@ -205,7 +205,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -362,7 +362,7 @@ public:
return;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiRangeCheck_Timer < uiDiff)
{
diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
index dc0b320b307..187cf5d6b30 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
@@ -102,7 +102,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
index d40f3b14f87..d308c6c696b 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
@@ -95,7 +95,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index 891b91c6dfb..b14a9e0dec5 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -154,7 +154,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -251,7 +251,7 @@ public:
uiRangeCheck_Timer = 1000;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
index cf0ee82c01c..0f150fe88b8 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
@@ -122,7 +122,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index 5ebc2eaf973..fbbf3fa3df5 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -342,7 +342,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
ScriptedAI::UpdateAI(uiDiff);
@@ -481,7 +481,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance && instance->GetData(DATA_MAIN_EVENT_PHASE) != IN_PROGRESS)
me->CastStop();
@@ -578,7 +578,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance) //Massive usage of instance, global check
return;
@@ -724,7 +724,7 @@ struct violet_hold_trashAI : public npc_escortAI
}
}
- void UpdateAI(const uint32)
+ void UpdateAI(uint32)
{
if (instance && instance->GetData(DATA_MAIN_EVENT_PHASE) != IN_PROGRESS)
me->CastStop();
@@ -832,7 +832,7 @@ public:
uiSunderArmorTimer = 4000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
@@ -910,7 +910,7 @@ public:
uiFrostboltTimer = 4000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
@@ -984,7 +984,7 @@ public:
uiSpellLockTimer = 5000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
@@ -1044,7 +1044,7 @@ public:
uiMagicReflectionTimer = 8000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
@@ -1097,7 +1097,7 @@ public:
TacticalBlinkCasted =false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
@@ -1159,7 +1159,7 @@ public:
uiConeOfColdTimer = 4000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
@@ -1239,7 +1239,7 @@ public:
uiWhirlwindTimer = 8000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
@@ -1293,7 +1293,7 @@ public:
uiManaDetonationTimer = 5000;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
violet_hold_trashAI::UpdateAI(diff);
npc_escortAI::UpdateAI(diff);
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index 8e7507bce61..fef900e1dfd 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -92,7 +92,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!phase)
return;
@@ -436,7 +436,7 @@ public:
DoCast(me, SPELL_DROP_CRATE, true);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (setCrateNumber)
{
@@ -576,7 +576,7 @@ public:
go_caribou->SetGoState(GO_STATE_READY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (phaseTimer <= diff)
{
@@ -701,7 +701,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IntroPhase)
{
@@ -867,7 +867,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (WithRedDragonBlood && HarpoonerGUID && !me->HasAura(SPELL_RED_DRAGONBLOOD))
{
@@ -1017,7 +1017,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
@@ -1360,7 +1360,7 @@ public:
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->talbotInPosition = true;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (bCheck)
{
@@ -1482,7 +1482,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
ScriptedAI::UpdateAI(uiDiff);
@@ -1622,7 +1622,7 @@ public:
}
}
- void UpdateAI(const uint32 /*uiDiff*/)
+ void UpdateAI(uint32 /*uiDiff*/)
{
if (!UpdateVictim())
return;
@@ -1674,7 +1674,7 @@ public:
rebuff = 0;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
UpdateVictim();
@@ -1990,7 +1990,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (bStarted)
{
@@ -2005,7 +2005,7 @@ public:
}
}
- void DoAction(const int32 param)
+ void DoAction(int32 param)
{
if (param == 1)
bStarted = true;
@@ -2105,7 +2105,7 @@ public:
uiExplosionTimer = urand(5000, 10000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiExplosionTimer < diff)
{
@@ -2160,7 +2160,7 @@ public:
uiTimer = urand(13000, 18000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (uiTimer <= diff)
{
@@ -2207,9 +2207,9 @@ class npc_warmage_coldarra : public CreatureScript
public:
npc_warmage_coldarra() : CreatureScript("npc_warmage_coldarra") { }
- struct npc_warmage_coldarraAI : public Scripted_NoMovementAI
+ struct npc_warmage_coldarraAI : public ScriptedAI
{
- npc_warmage_coldarraAI(Creature* creature) : Scripted_NoMovementAI(creature){}
+ npc_warmage_coldarraAI(Creature* creature) : ScriptedAI(creature) {}
uint32 m_uiTimer; //Timer until recast
@@ -2222,7 +2222,7 @@ public:
void AttackStart(Unit* /*who*/) {}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (m_uiTimer <= uiDiff)
{
@@ -2358,7 +2358,7 @@ public:
me->RestoreFaction();
}
- void DoAction(const int32 /*iParam*/)
+ void DoAction(int32 /*iParam*/)
{
me->StopMoving();
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
@@ -2383,7 +2383,7 @@ public:
me->AI()->AttackStart(player);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiEventTimer && uiEventTimer <= uiDiff)
{
diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
index d12b5176b15..d05e442b0f4 100644
--- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
+++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp
@@ -49,9 +49,12 @@ class npc_warmage_violetstand : public CreatureScript
public:
npc_warmage_violetstand() : CreatureScript("npc_warmage_violetstand") { }
- struct npc_warmage_violetstandAI : public Scripted_NoMovementAI
+ struct npc_warmage_violetstandAI : public ScriptedAI
{
- npc_warmage_violetstandAI(Creature* creature) : Scripted_NoMovementAI(creature){}
+ npc_warmage_violetstandAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
uint64 uiTargetGUID;
@@ -60,7 +63,7 @@ public:
uiTargetGUID = 0;
}
- void UpdateAI(const uint32 /*uiDiff*/)
+ void UpdateAI(uint32 /*uiDiff*/)
{
if (me->IsNonMeleeSpellCasted(false))
return;
diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp
index d16b6fe4588..33440cad48b 100644
--- a/src/server/scripts/Northrend/zone_dalaran.cpp
+++ b/src/server/scripts/Northrend/zone_dalaran.cpp
@@ -55,9 +55,9 @@ class npc_mageguard_dalaran : public CreatureScript
public:
npc_mageguard_dalaran() : CreatureScript("npc_mageguard_dalaran") { }
- struct npc_mageguard_dalaranAI : public Scripted_NoMovementAI
+ struct npc_mageguard_dalaranAI : public ScriptedAI
{
- npc_mageguard_dalaranAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_mageguard_dalaranAI(Creature* creature) : ScriptedAI(creature)
{
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_NORMAL, true);
@@ -117,7 +117,7 @@ public:
return;
}
- void UpdateAI(const uint32 /*diff*/){}
+ void UpdateAI(uint32 /*diff*/){}
};
CreatureAI* GetAI(Creature* creature) const
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index a8fb0215902..ed7354acb50 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -248,7 +248,7 @@ class npc_wyrmrest_defender : public CreatureScript
RenewRecoveryChecker = 0;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// Check system for Health Warning should happen first time whenever get under 30%,
// after it should be able to happen only after recovery of last renew is fully done (20 sec),
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index fe1f561071c..e8eddea6ef7 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -192,7 +192,7 @@ public:
RWORGGUID = 0;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
@@ -264,7 +264,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -369,7 +369,7 @@ public:
m_uiPhase = 1;
}
- void UpdateAI(const uint32 /*uiDiff*/)
+ void UpdateAI(uint32 /*uiDiff*/)
{
if (m_uiPhase == 1)
{
@@ -416,7 +416,7 @@ public:
m_uiPhase = 1;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
// call this each update tick?
if (me->FindNearestCreature(TALLHORN_STAG, 0.2f))
@@ -510,7 +510,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -558,7 +558,7 @@ public:
uiChargedSentryTotem = urand(10000, 12000);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -624,7 +624,7 @@ class npc_venture_co_straggler : public CreatureScript
me->SetReactState(REACT_AGGRESSIVE);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiPlayerGUID && uiRunAwayTimer <= uiDiff)
{
diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp
index 098fa80a3d3..d5641b0fcc7 100644
--- a/src/server/scripts/Northrend/zone_icecrown.cpp
+++ b/src/server/scripts/Northrend/zone_icecrown.cpp
@@ -219,7 +219,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -264,9 +264,12 @@ class npc_guardian_pavilion : public CreatureScript
public:
npc_guardian_pavilion() : CreatureScript("npc_guardian_pavilion") { }
- struct npc_guardian_pavilionAI : public Scripted_NoMovementAI
+ struct npc_guardian_pavilionAI : public ScriptedAI
{
- npc_guardian_pavilionAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ npc_guardian_pavilionAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
void MoveInLineOfSight(Unit* who)
{
@@ -370,9 +373,12 @@ class npc_tournament_training_dummy : public CreatureScript
public:
npc_tournament_training_dummy(): CreatureScript("npc_tournament_training_dummy"){}
- struct npc_tournament_training_dummyAI : Scripted_NoMovementAI
+ struct npc_tournament_training_dummyAI : ScriptedAI
{
- npc_tournament_training_dummyAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ npc_tournament_training_dummyAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
EventMap events;
bool isVulnerable;
@@ -442,7 +448,7 @@ class npc_tournament_training_dummy : public CreatureScript
isVulnerable = true;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
@@ -584,13 +590,15 @@ class npc_blessed_banner : public CreatureScript
public:
npc_blessed_banner() : CreatureScript("npc_blessed_banner") { }
- struct npc_blessed_bannerAI : public Scripted_NoMovementAI
+ struct npc_blessed_bannerAI : public ScriptedAI
{
- npc_blessed_bannerAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me)
+ npc_blessed_bannerAI(Creature* creature) : ScriptedAI(creature), Summons(me)
{
HalofSpawned = false;
PhaseCount = 0;
Summons.DespawnAll();
+
+ SetCombatMovement(false);
}
EventMap events;
@@ -629,7 +637,7 @@ public:
me->DespawnOrUnsummon();
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
events.Update(diff);
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
index 7db2ae4707b..63143673185 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -321,7 +321,7 @@ public:
Reset();
}
- void UpdateAI(const uint32 /*uiDiff*/)
+ void UpdateAI(uint32 /*uiDiff*/)
{
if (!UpdateVictim())
return;
@@ -420,7 +420,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
@@ -582,7 +582,7 @@ public:
timer -= diff;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (phase)
proceedCwEvent(uiDiff);
@@ -1120,7 +1120,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
CreatureAI* GetAI(Creature* creature) const
diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp
index dae2ffd36f6..ba725d2dda4 100644
--- a/src/server/scripts/Northrend/zone_storm_peaks.cpp
+++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp
@@ -186,7 +186,7 @@ public:
player->FailQuest(QUEST_BITTER_DEPARTURE);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
if (!UpdateVictim())
@@ -318,7 +318,7 @@ public:
Reset();
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!freed)
return;
@@ -356,34 +356,20 @@ public:
enum FreedProtoDrake
{
+ NPC_DRAKE = 29709,
+
AREA_VALLEY_OF_ANCIENT_WINTERS = 4437,
+
TEXT_EMOTE = 0,
+
SPELL_KILL_CREDIT_PRISONER = 55144,
SPELL_SUMMON_LIBERATED = 55073,
- SPELL_KILL_CREDIT_DRAKE = 55143
-};
+ SPELL_KILL_CREDIT_DRAKE = 55143,
-const Position FreedDrakeWaypoints[16] =
-{
- {7294.96f, -2418.733f, 823.869f, 0.0f},
- {7315.984f, -2331.46f, 826.3972f, 0.0f},
- {7271.826f, -2271.479f, 833.5917f, 0.0f},
- {7186.253f, -2218.475f, 847.5632f, 0.0f},
- {7113.195f, -2164.288f, 850.2301f, 0.0f},
- {7078.018f, -2063.106f, 854.7581f, 0.0f},
- {7073.221f, -1983.382f, 861.9246f, 0.0f},
- {7061.455f, -1885.899f, 865.119f, 0.0f},
- {7033.32f, -1826.775f, 876.2578f, 0.0f},
- {6999.902f, -1784.012f, 897.4521f, 0.0f},
- {6954.913f, -1747.043f, 897.4521f, 0.0f},
- {6933.856f, -1720.698f, 882.2022f, 0.0f},
- {6932.729f, -1687.306f, 866.1189f, 0.0f},
- {6952.458f, -1663.802f, 849.8133f, 0.0f},
- {7002.819f, -1651.681f, 831.397f, 0.0f},
- {7026.531f, -1649.239f, 828.8406f, 0.0f}
+ EVENT_CHECK_AREA = 1,
+ EVENT_REACHED_HOME = 2,
};
-
class npc_freed_protodrake : public CreatureScript
{
public:
@@ -393,74 +379,60 @@ public:
{
npc_freed_protodrakeAI(Creature* creature) : VehicleAI(creature) {}
- bool autoMove;
- bool wpReached;
- uint16 CheckTimer;
- uint16 countWP;
+ EventMap events;
void Reset()
{
- autoMove = false;
- wpReached = false;
- CheckTimer = 5000;
- countWP = 0;
+ events.ScheduleEvent(EVENT_CHECK_AREA, 5000);
}
void MovementInform(uint32 type, uint32 id)
{
- if (type != POINT_MOTION_TYPE)
+ if (type != WAYPOINT_MOTION_TYPE)
return;
- if (id < 15)
- {
- ++countWP;
- wpReached = true;
- }
- else
+ if (id == 15)
// drake reached village
- {
- // get player that rides drake (from seat 0)
- Unit* player = me->GetVehicleKit()->GetPassenger(0);
- if (player && player->GetTypeId() == TYPEID_PLAYER)
- {
- // for each prisoner on drake, give credit
- for (uint8 i = 1; i < 4; ++i)
- if (Unit* prisoner = me->GetVehicleKit()->GetPassenger(i))
- {
- if (prisoner->GetTypeId() != TYPEID_UNIT)
- return;
- prisoner->CastSpell(player, SPELL_KILL_CREDIT_PRISONER, true);
- prisoner->CastSpell(prisoner, SPELL_SUMMON_LIBERATED, true);
- prisoner->ExitVehicle();
- }
- me->CastSpell(me, SPELL_KILL_CREDIT_DRAKE, true);
- player->ExitVehicle();
- }
- }
+ events.ScheduleEvent(EVENT_REACHED_HOME, 2000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
- if (!autoMove)
+ events.Update(diff);
+
+ switch (events.ExecuteEvent())
{
- if (CheckTimer < diff)
- {
- CheckTimer = 5000;
+ case EVENT_CHECK_AREA:
if (me->GetAreaId() == AREA_VALLEY_OF_ANCIENT_WINTERS)
{
- Talk(TEXT_EMOTE, me->GetVehicleKit()->GetPassenger(0)->GetGUID());
- autoMove = true;
- wpReached = true;
+ if (Vehicle* vehicle = me->GetVehicleKit())
+ if (Unit* passenger = vehicle->GetPassenger(0))
+ {
+ Talk(TEXT_EMOTE, passenger->GetGUID());
+ me->GetMotionMaster()->MovePath(NPC_DRAKE, false);
+ }
}
- }
- else
- CheckTimer -= diff;
- }
-
- if (wpReached && autoMove)
- {
- wpReached = false;
- me->GetMotionMaster()->MovePoint(countWP, FreedDrakeWaypoints[countWP]);
+ else
+ events.ScheduleEvent(EVENT_CHECK_AREA, 5000);
+ break;
+ case EVENT_REACHED_HOME:
+ Unit* player = me->GetVehicleKit()->GetPassenger(0);
+ if (player && player->GetTypeId() == TYPEID_PLAYER)
+ {
+ // for each prisoner on drake, give credit
+ for (uint8 i = 1; i < 4; ++i)
+ if (Unit* prisoner = me->GetVehicleKit()->GetPassenger(i))
+ {
+ if (prisoner->GetTypeId() != TYPEID_UNIT)
+ return;
+ prisoner->CastSpell(player, SPELL_KILL_CREDIT_PRISONER, true);
+ prisoner->CastSpell(prisoner, SPELL_SUMMON_LIBERATED, true);
+ prisoner->ExitVehicle();
+ }
+ me->CastSpell(me, SPELL_KILL_CREDIT_DRAKE, true);
+ player->ExitVehicle();
+ }
+ break;
}
}
};
@@ -505,7 +477,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
@@ -544,7 +516,7 @@ class npc_hyldsmeet_protodrake : public CreatureScript
_accessoryRespawnTimer = 5 * MINUTE * IN_MILLISECONDS;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
//! We need to manually reinstall accessories because the vehicle itself is friendly to players,
//! so EnterEvadeMode is never triggered. The accessory on the other hand is hostile and killable.
diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp
index 8c255d49d25..ce0eaefac90 100644
--- a/src/server/scripts/Northrend/zone_wintergrasp.cpp
+++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp
@@ -224,7 +224,7 @@ class npc_wg_spirit_guide : public CreatureScript
{
npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) { }
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!me->HasUnitState(UNIT_STATE_CASTING))
DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL);
diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp
index 69e8d900435..33a573b9b35 100644
--- a/src/server/scripts/Northrend/zone_zuldrak.cpp
+++ b/src/server/scripts/Northrend/zone_zuldrak.cpp
@@ -170,7 +170,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (UpdateVictim())
{
@@ -409,7 +409,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
ScriptedAI::UpdateAI(uiDiff);
@@ -636,7 +636,7 @@ public:
DoCast(who, SPELL_IMPALE);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -761,7 +761,7 @@ public:
DoCast(me, SPELL_GROW);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
@@ -832,7 +832,7 @@ public:
uiCorrodeFleshTimer = 6000;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -950,7 +950,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
@@ -1099,7 +1099,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -1213,7 +1213,7 @@ public:
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (!UpdateVictim())
return;
@@ -1309,7 +1309,7 @@ public:
m_heading = me->GetOrientation();
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (m_uiPhase)
{
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 040ca012902..0fb49dfc284 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
@@ -72,7 +72,7 @@ public:
myClass = myclass;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -234,7 +234,7 @@ public:
me->SummonCreature(19412, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -322,7 +322,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 7509f6331f7..00ec9b9fe4a 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
@@ -94,7 +94,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Inhibitmagic_Timer
if (Inhibitmagic_Timer <= diff)
@@ -185,7 +185,7 @@ public:
void EnterCombat(Unit* /*who*/)
{ }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 7e1fa41c6da..f26760a82b7 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
@@ -149,7 +149,7 @@ public:
summons.DespawnAll();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -269,7 +269,7 @@ public:
summoned->AI()->AttackStart(me->getVictim());
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -335,7 +335,7 @@ public:
isFireboltTurn = true;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
index c8bd6dbb069..e4d8d959941 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
@@ -82,7 +82,7 @@ public:
Talk(SAY_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
index 1a53a140f28..371c94035ac 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
@@ -127,7 +127,7 @@ public:
DoCast(me, SPELL_SUMMON_SYTH_SHADOW, true); //right
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -220,7 +220,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -279,7 +279,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -333,7 +333,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -388,7 +388,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
index 8a872039e37..4a9a98abcde 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
@@ -127,7 +127,7 @@ public:
Talk(SAY_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 b9163c13413..cd7f8e120de 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
@@ -142,7 +142,7 @@ public:
instance->SetData(TYPE_HELLMAW, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Intro && !HasEscortState(STATE_ESCORT_ESCORTING))
{
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 4ae2d59799a..0c0bae17c5d 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
@@ -106,7 +106,7 @@ public:
instance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 80eb7c03819..a067bbf92a0 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -93,7 +93,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!VorpilGUID)
{
@@ -264,7 +264,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
index fbe62e2a003..e09371bca13 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
@@ -111,7 +111,7 @@ public:
me->DealDamage(target, (target->GetHealth()*90)/100, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NATURE, spell);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target or casting
if (!UpdateVictim() || me->IsNonMeleeSpellCasted(false))
diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
index 3a56a0bfed2..5a292d165cc 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
@@ -187,9 +187,7 @@ public:
void RevertThreatOnTarget(uint64 guid)
{
- Unit* unit = NULL;
- unit = Unit::GetUnit(*me, guid);
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, guid))
{
if (DoGetThreat(unit))
DoModifyThreatPercent(unit, -100);
@@ -198,7 +196,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -279,8 +277,7 @@ public:
{
if (Phase1)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target && target->isAlive())
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
Phase1 = false;
@@ -308,7 +305,8 @@ public:
AcidGeyserTimer = 1000;
PhaseChangeTimer = 30000;
}
- } else // Encounter is a loop pretty much. Phase 1 -> Phase 2 -> Phase 1 -> Phase 2 till death or enrage
+ }
+ else // Encounter is a loop pretty much. Phase 1 -> Phase 2 -> Phase 1 -> Phase 2 till death or enrage
{
if (TargetGUID)
RevertThreatOnTarget(TargetGUID);
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index b8003761cc7..844428c8fa7 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -422,8 +422,7 @@ public:
Glaive->InterruptNonMeleeSpells(true);
DoCast(me, SPELL_FLAME_ENRAGE, true);
DoResetThreat();
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target && target->isAlive())
+ if (SelectTarget(SELECT_TARGET_RANDOM, 0))
{
me->AddThreat(me->getVictim(), 5000000.0f);
AttackStart(me->getVictim());
@@ -442,7 +441,7 @@ public:
GlaiveGUID = guid;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -957,7 +956,7 @@ public:
++TransformCount;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if ((!UpdateVictim()) && Phase < PHASE_TALK_SEQUENCE)
return;
@@ -1231,7 +1230,7 @@ public:
ScriptedAI::AttackStart(who);
}
- void DoAction(const int32 param)
+ void DoAction(int32 param)
{
if (param > PHASE_ILLIDAN_NULL && param < PHASE_ILLIDAN_MAX)
EnterPhase(PhaseIllidan(param));
@@ -1303,7 +1302,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if ((!UpdateVictim())
&& !Timer[EVENT_MAIEV_STEALTH])
@@ -1733,7 +1732,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->IsVisible())
{
@@ -2079,7 +2078,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (DespawnTimer)
{
@@ -2150,7 +2149,7 @@ public:
target->RemoveAurasDueToSpell(SPELL_PARALYZE);
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -2248,7 +2247,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->getVictim())
{
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index ec85d675225..dc56f7abe07 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -174,7 +174,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 f9c46aa3f77..a6432114ded 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -248,7 +248,7 @@ public:
instance->SetData(DATA_RELIQUARYOFSOULSEVENT, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Phase)
return;
@@ -469,7 +469,7 @@ public:
me->AddThreat(target, 1000000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (me->isInCombat())
{
@@ -574,7 +574,7 @@ public:
Talk(DESI_SAY_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -665,7 +665,7 @@ public:
Talk(ANGER_SAY_SLAY);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 fe5af2a689e..9860cf0385a 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -139,7 +139,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
};
@@ -175,7 +175,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (StartBanishing)
return;
@@ -423,7 +423,7 @@ public:
void SetAkamaGUID(uint64 guid) { AkamaGUID = guid; }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat())
return;
@@ -725,7 +725,7 @@ public:
summons.DespawnAll();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!EventBegun)
return;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
index 6bc6633e49e..114f83661b3 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
@@ -203,7 +203,7 @@ public:
return target;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -272,9 +272,12 @@ public:
return new npc_volcanoAI (creature);
}
- struct npc_volcanoAI : public Scripted_NoMovementAI
+ struct npc_volcanoAI : public ScriptedAI
{
- npc_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ npc_volcanoAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
void Reset()
{
@@ -290,12 +293,12 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void DoAction(const int32 /*info*/)
+ void DoAction(int32 /*info*/)
{
me->RemoveAura(SPELL_VOLCANIC_ERUPTION);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (wait <= diff)//wait 3secs before casting
{
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index 6c28b058cf7..5eb9ffcabc8 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -86,7 +86,7 @@ public:
me->RemoveCorpse();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (CheckTeronTimer <= diff)
{
@@ -188,7 +188,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (CheckPlayerTimer <= diff)
{
@@ -378,7 +378,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Intro && !Done)
{
@@ -468,8 +468,7 @@ public:
if (CrushingShadowsTimer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target && target->isAlive())
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_CRUSHING_SHADOWS);
CrushingShadowsTimer = urand(10, 26) * 1000;
} else CrushingShadowsTimer -= diff;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 7a56734bc3b..127ca68ce39 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -146,7 +146,7 @@ public:
events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 03fa5235d18..d63e8ee20b0 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -169,7 +169,7 @@ public:
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!EventStarted)
return;
@@ -315,7 +315,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!EventBegun)
return;
@@ -536,7 +536,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -641,7 +641,7 @@ public:
Talk(SAY_ZERE_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -741,7 +741,7 @@ public:
Talk(SAY_MALA_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -827,7 +827,7 @@ public:
Talk(SAY_VERA_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 d9ad35f9552..b9df26d11c6 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -222,14 +222,12 @@ public:
StartEvent(who);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT))
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER));
-
- if (target)
+ if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
{
AttackStart(target);
GetAdvisors();
@@ -360,12 +358,8 @@ public:
{
if (instance)
{
- Creature* Karathress = NULL;
- Karathress = (Unit::GetCreature((*me), instance->GetData64(DATA_KARATHRESS)));
-
- if (Karathress)
- if (!me->isAlive() && Karathress)
- CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath();
+ if (Creature* Karathress = (Unit::GetCreature((*me), instance->GetData64(DATA_KARATHRESS))))
+ CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath();
}
}
@@ -378,17 +372,13 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT))
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER));
-
- if (target)
- {
+ if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
- }
}
//Return since we have no target
@@ -445,12 +435,13 @@ public:
pet_id = CREATURE_FATHOM_SPOREBAT;
}
//DoCast(me, spell_id, true);
- Creature* Pet = DoSpawnCreature(pet_id, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (Pet && target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
- Pet->AI()->AttackStart(target);
- SummonedPet = Pet->GetGUID();
+ if (Creature* Pet = DoSpawnCreature(pet_id, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
+ {
+ Pet->AI()->AttackStart(target);
+ SummonedPet = Pet->GetGUID();
+ }
}
} else Pet_Timer -= diff;
@@ -500,12 +491,8 @@ public:
{
if (instance)
{
- Creature* Karathress = NULL;
- Karathress = (Unit::GetCreature((*me), instance->GetData64(DATA_KARATHRESS)));
-
- if (Karathress)
- if (!me->isAlive() && Karathress)
- CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath();
+ if (Creature* Karathress = Unit::GetCreature((*me), instance->GetData64(DATA_KARATHRESS)))
+ CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath();
}
}
@@ -519,17 +506,13 @@ public:
DoCast(me, SPELL_WINDFURY_WEAPON);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT))
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER));
-
- if (target)
- {
+ if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
- }
}
//Return since we have no target
@@ -627,12 +610,8 @@ public:
{
if (instance)
{
- Creature* Karathress = NULL;
- Karathress = (Unit::GetCreature((*me), instance->GetData64(DATA_KARATHRESS)));
-
- if (Karathress)
- if (!me->isAlive() && Karathress)
- CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath();
+ if (Creature* Karathress = Unit::GetCreature((*me), instance->GetData64(DATA_KARATHRESS)))
+ CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath();
}
}
@@ -645,17 +624,13 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_KARATHRESSEVENT))
{
- Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER));
-
- if (target)
- {
+ if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER)))
AttackStart(target);
- }
}
//Return since we have no target
@@ -697,11 +672,8 @@ public:
Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Cyclone->setFaction(me->getFaction());
Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true);
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
- {
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
Cyclone->AI()->AttackStart(target);
- }
}
} else Cyclone_Timer -= diff;
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 b31292c4b00..2f0d736d8ef 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
@@ -212,7 +212,7 @@ public:
Summons.DespawnAll();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!beam)
{
@@ -272,8 +272,7 @@ public:
//VileSludge_Timer
if (VileSludge_Timer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_VILE_SLUDGE);
VileSludge_Timer = 15000;
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 b0717d29228..19b57509093 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -310,7 +310,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!CanAttack && Intro)
{
@@ -599,7 +599,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance)
return;
@@ -677,7 +677,7 @@ public:
me->AddThreat(who, 0.1f);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// PoisonBoltTimer
if (PoisonBoltTimer <= diff)
@@ -754,7 +754,7 @@ public:
MovementTimer = 0;
}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
// Random movement
if (MovementTimer <= diff)
@@ -834,7 +834,7 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI (const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!instance)
return;
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 2c8d067a865..f4e0c6cee2a 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
@@ -132,7 +132,7 @@ public:
return;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -316,7 +316,7 @@ public:
me->SetDisplayId(MODEL_NIGHTELF);
// and reseting equipment
- me->LoadEquipment(me->GetEquipmentId());
+ me->LoadEquipment();
if (instance && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
{
@@ -410,10 +410,10 @@ public:
if (me->HasAura(AURA_BANISH))
return;
- me->LoadEquipment(me->GetEquipmentId());
+ me->LoadEquipment();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (me->HasAura(AURA_BANISH) || !UpdateVictim())
@@ -558,7 +558,7 @@ public:
{
//switch to nightelf form
me->SetDisplayId(MODEL_NIGHTELF);
- me->LoadEquipment(me->GetEquipmentId());
+ me->LoadEquipment();
CastConsumingMadness();
DespawnDemon();
@@ -589,7 +589,7 @@ public:
Talk(SAY_FINAL_FORM);
me->SetDisplayId(MODEL_NIGHTELF);
- me->LoadEquipment(me->GetEquipmentId());
+ me->LoadEquipment();
}
}
};
@@ -643,7 +643,7 @@ public:
StartEvent();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -737,7 +737,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (instance)
{
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 788de7753ff..18324822c4a 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -78,10 +78,11 @@ public:
return new boss_the_lurker_belowAI (creature);
}
- struct boss_the_lurker_belowAI : public Scripted_NoMovementAI
+ struct boss_the_lurker_belowAI : public ScriptedAI
{
- boss_the_lurker_belowAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me)
+ boss_the_lurker_belowAI(Creature* creature) : ScriptedAI(creature), Summons(me)
{
+ SetCombatMovement(false);
instance = creature->GetInstanceScript();
}
@@ -152,11 +153,10 @@ public:
Summons.DespawnAll();
}
- void EnterCombat(Unit* who)
+ void EnterCombat(Unit* /*who*/)
{
if (instance)
instance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS);
- Scripted_NoMovementAI::EnterCombat(who);
}
void MoveInLineOfSight(Unit* who)
@@ -177,7 +177,7 @@ public:
me->SetReactState(REACT_AGGRESSIVE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!CanStartEvent) // boss is invisible, don't attack
{
@@ -368,10 +368,11 @@ public:
return new mob_coilfang_ambusherAI (creature);
}
- struct mob_coilfang_ambusherAI : public Scripted_NoMovementAI
+ struct mob_coilfang_ambusherAI : public ScriptedAI
{
- mob_coilfang_ambusherAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ mob_coilfang_ambusherAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
}
uint32 MultiShotTimer;
@@ -392,7 +393,7 @@ public:
AttackStart(who);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (MultiShotTimer <= diff)
{
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 9476bb28f8e..592746742f5 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
@@ -163,7 +163,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
@@ -184,10 +184,9 @@ public:
for (uint8 i = 0; i < 10; ++i)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- Creature* Murloc = me->SummonCreature(NPC_TIDEWALKER_LURKER, MurlocCords[i][0], MurlocCords[i][1], MurlocCords[i][2], MurlocCords[i][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
- if (target && Murloc)
- Murloc->AI()->AttackStart(target);
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ if (Creature* Murloc = me->SummonCreature(NPC_TIDEWALKER_LURKER, MurlocCords[i][0], MurlocCords[i][1], MurlocCords[i][2], MurlocCords[i][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000))
+ Murloc->AI()->AttackStart(target);
}
Talk(EMOTE_EARTHQUAKE);
Earthquake = false;
@@ -321,7 +320,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
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 f2ed2560bbf..c9d394f6f2d 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
@@ -101,7 +101,7 @@ public:
instance->SetData(TYPE_HYDROMANCER_THESPIA, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -170,7 +170,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 3897f370b0c..12e4e3a496f 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
@@ -122,7 +122,7 @@ public:
DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC, 7, -5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -223,7 +223,7 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Repair_Timer <= diff)
{
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 23b25da91ea..914539b27c9 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
@@ -167,7 +167,7 @@ public:
instance->SetData(TYPE_WARLORD_KALITHRESH, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
index c55e93726a9..7e2c13483bd 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
@@ -63,7 +63,7 @@ public:
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -138,7 +138,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Stop)
return;
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 1e8fd8b2676..22f406c6c5b 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
@@ -102,7 +102,7 @@ public:
strider->DisappearAndDie();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
index 0a5c8b0c8b6..8abde7e0694 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
@@ -158,7 +158,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
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 83596c46936..3018c18383e 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
@@ -217,7 +217,7 @@ public:
DoZoneInCombat();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
@@ -377,7 +377,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
@@ -492,7 +492,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
@@ -519,8 +519,7 @@ public:
//GreaterPolymorph_Timer
if (GreaterPolymorph_Timer <= diff)
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_GREATER_POLYMORPH);
GreaterPolymorph_Timer = urand(15000, 20000);
@@ -612,7 +611,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
@@ -722,7 +721,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Only if not incombat check if the event is started
if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index 6d3ec669cd5..0e584686f9b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -84,7 +84,7 @@ class boss_broggok : public CreatureScript
summoned->CastSpell(summoned, SPELL_POISON, false, 0, 0, me->GetGUID());
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -127,7 +127,7 @@ class boss_broggok : public CreatureScript
}
}
- void DoAction(int32 const action)
+ void DoAction(int32 action)
{
switch (action)
{
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 7d8885ae0ae..d2096140ff4 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
@@ -201,7 +201,7 @@ class boss_kelidan_the_breaker : public CreatureScript
instance->HandleGameObject(instance->GetData64(DATA_DOOR6), true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
{
@@ -330,7 +330,7 @@ class mob_shadowmoon_channeler : public CreatureScript
CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(killer);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
{
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 bab49b95974..8014ee9f8e0 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
@@ -105,7 +105,7 @@ class boss_the_maker : public CreatureScript
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 b83307d8dcc..0c5325f7172 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
@@ -118,7 +118,7 @@ class boss_omor_the_unscarred : public CreatureScript
Talk(SAY_DIE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 30a2813b286..e820e22d65a 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
@@ -124,7 +124,7 @@ class boss_nazan : public CreatureScript
me->SummonCreature(ENTRY_LIQUID_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -243,7 +243,7 @@ class boss_vazruden : public CreatureScript
Talk(SAY_DIE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
{
@@ -396,7 +396,7 @@ class boss_vazruden_the_herald : public CreatureScript
sentryDown = true;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
switch (phase)
{
@@ -487,7 +487,7 @@ class mob_hellfire_sentry : public CreatureScript
CAST_AI(boss_vazruden_the_herald::boss_vazruden_the_heraldAI, herald->AI())->SentryDownBy(killer);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 7aae6cebff9..8961c94ab31 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
@@ -112,7 +112,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
Talk(SAY_DIE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index aeec7d14b26..777f24f779b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -151,7 +151,7 @@ class mob_abyssal : public CreatureScript
ScriptedAI::MoveInLineOfSight(who);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (trigger)
{
@@ -339,7 +339,7 @@ class boss_magtheridon : public CreatureScript
Talk(SAY_FREED);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat())
{
@@ -528,7 +528,7 @@ class mob_hellfire_channeler : public CreatureScript
instance->SetData(DATA_CHANNELER_EVENT, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 00f0fd8964e..09dd791020e 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -213,7 +213,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
instance->HandleGameObject(instance->GetData64(DATA_NETHEKURSE_DOOR), true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsIntroEvent)
{
@@ -346,7 +346,7 @@ class mob_fel_orc_convert : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 dd23f89dcfb..ac261cc5936 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
@@ -130,7 +130,7 @@ class mob_omrogg_heads : public CreatureScript
DeathYell = true;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!DeathYell)
return;
@@ -312,7 +312,7 @@ class boss_warbringer_omrogg : public CreatureScript
instance->SetData(TYPE_OMROGG, DONE);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Delay_Timer <= diff)
{
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 f437018ac4b..13f47b276ef 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
@@ -194,7 +194,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript
me->SummonCreature(MOB_SHATTERED_ASSASSIN, AssassExit[0], AssassExit[1]-8, AssassExit[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index f0a823472df..099bd6949cb 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -212,7 +212,7 @@ class boss_alar : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat()) // sometimes isincombat but !incombat, faction bug?
return;
@@ -515,7 +515,7 @@ class mob_ember_of_alar : public CreatureScript
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -553,7 +553,7 @@ class mob_flame_patch_alar : public CreatureScript
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 /*diff*/) {}
+ void UpdateAI(uint32 /*diff*/) {}
};
CreatureAI* GetAI(Creature* creature) const
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index 01ca1636c6b..b8245729d73 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -195,7 +195,7 @@ class boss_high_astromancer_solarian : public CreatureScript
return (z*sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -245,11 +245,13 @@ class boss_high_astromancer_solarian : public CreatureScript
}
else
{
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (!me->HasInArc(2.5f, target))
- target = me->getVictim();
- if (target)
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ {
+ if (!me->HasInArc(2.5f, target))
+ target = me->getVictim();
+
DoCast(target, SPELL_ARCANE_MISSILES);
+ }
}
ArcaneMissiles_Timer = 3000;
}
@@ -441,7 +443,7 @@ class mob_solarium_priest : public CreatureScript
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index 07d563cd762..a6497e6a373 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -241,7 +241,7 @@ struct advisorbase_ai : public ScriptedAI
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (DelayRes_Timer)
{
@@ -465,7 +465,7 @@ class boss_kaelthas : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Phase 1
switch (Phase)
@@ -1046,7 +1046,7 @@ class boss_thaladred_the_darkener : public CreatureScript
Talk(SAY_THALADRED_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
advisorbase_ai::UpdateAI(diff);
@@ -1138,7 +1138,7 @@ class boss_lord_sanguinar : public CreatureScript
Talk(SAY_SANGUINAR_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
advisorbase_ai::UpdateAI(diff);
@@ -1227,7 +1227,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
return;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
advisorbase_ai::UpdateAI(diff);
@@ -1353,7 +1353,7 @@ class boss_master_engineer_telonicus : public CreatureScript
Talk(SAY_TELONICUS_AGGRO);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
advisorbase_ai::UpdateAI(diff);
@@ -1404,9 +1404,12 @@ class mob_kael_flamestrike : public CreatureScript
: CreatureScript("mob_kael_flamestrike")
{
}
- struct mob_kael_flamestrikeAI : public Scripted_NoMovementAI
+ struct mob_kael_flamestrikeAI : public ScriptedAI
{
- mob_kael_flamestrikeAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
+ mob_kael_flamestrikeAI(Creature* creature) : ScriptedAI(creature)
+ {
+ SetCombatMovement(false);
+ }
uint32 Timer;
bool Casting;
@@ -1426,7 +1429,7 @@ class mob_kael_flamestrike : public CreatureScript
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Casting)
{
@@ -1487,7 +1490,7 @@ class mob_phoenix_tk : public CreatureScript
me->SummonCreature(NPC_PHOENIX_EGG, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 16000);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1553,7 +1556,7 @@ class mob_phoenix_egg_tk : public CreatureScript
summoned->CastSpell(summoned, SPELL_REBIRTH, false);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Rebirth_Timer)
return;
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 468c9ab1e75..d4526e52543 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
@@ -100,7 +100,7 @@ class boss_void_reaver : public CreatureScript
instance->SetData(DATA_VOIDREAVEREVENT, IN_PROGRESS);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
index d5e39d09301..fd00b2c5b4e 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
@@ -62,7 +62,7 @@ class mob_crystalcore_devastator : public CreatureScript
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 dc9940c87b8..2b597be8a9f 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
@@ -79,7 +79,7 @@ class boss_gatewatcher_gyrokill : public CreatureScript
Talk(SAY_SLAY);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 440e17a29cf..4a2026a4ed1 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
@@ -83,7 +83,7 @@ class boss_gatewatcher_iron_hand : public CreatureScript
Talk(SAY_DEATH);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 1a43798ccef..728b3f715b2 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
@@ -99,7 +99,7 @@ class boss_mechano_lord_capacitus : public CreatureScript
Talk(YELL_DEATH);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 9bda618b732..902fb8e76b3 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
@@ -91,7 +91,7 @@ class boss_nethermancer_sepethrea : public CreatureScript
Talk(SAY_DEATH);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -177,7 +177,7 @@ class mob_ragin_flames : public CreatureScript
{
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Check_Timer
if (Check_Timer <= diff)
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 9d894e41b60..65cd195fb80 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
@@ -106,7 +106,7 @@ class boss_pathaleon_the_calculator : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -189,7 +189,7 @@ class mob_nether_wraith : public CreatureScript
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
index cd3fb897181..0b52b705753 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
@@ -138,7 +138,7 @@ class npc_millhouse_manastorm : public CreatureScript
->FailQuest();*/
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Init)
{
@@ -398,7 +398,7 @@ class npc_warden_mellichar : public CreatureScript
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!IsRunning)
return;
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 141257dae63..c6f47fe8de7 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
@@ -152,7 +152,7 @@ class boss_harbinger_skyriss : public CreatureScript
DoCast(me, SPELL_33_ILLUSION);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Intro)
{
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 20531f1f110..6775fb95824 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp
@@ -93,7 +93,7 @@ class boss_commander_sarannis : public CreatureScript
BossAI::JustSummoned(summon);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 2ab527c2fd5..39ca6d32196 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
@@ -114,7 +114,7 @@ class boss_high_botanist_freywinn : public CreatureScript
Talk(SAY_DEATH);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
index bd9195e44f8..7b4ef77ac10 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
@@ -167,7 +167,7 @@ class boss_laj : public CreatureScript
summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 ffd48f4dcb5..70b626190b7 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
@@ -95,7 +95,7 @@ class boss_thorngrin_the_tender : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
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 d2b6c44ec7b..1275550a340 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -90,7 +90,7 @@ class mob_warp_splinter_treant : public CreatureScript
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
{
@@ -190,7 +190,7 @@ class boss_warp_splinter : public CreatureScript
Talk(SAY_SUMMON);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
index 8886e3e41f0..0e66893d3ac 100644
--- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
+++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
@@ -108,7 +108,7 @@ class boss_doomlord_kazzak : public CreatureScript
Talk(SAY_DEATH);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// Return since we have no target
if (!UpdateVictim())
diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp
index 9826900d246..33896800ada 100644
--- a/src/server/scripts/Outland/boss_doomwalker.cpp
+++ b/src/server/scripts/Outland/boss_doomwalker.cpp
@@ -97,7 +97,7 @@ class boss_doomwalker : public CreatureScript
who->CastSpell(who, SPELL_AURA_DEATH, 1);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
index d03abc82b9c..fc317c4eca7 100644
--- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
@@ -71,7 +71,7 @@ public:
void Reset() { }
- void UpdateAI(const uint32 /*uiDiff*/)
+ void UpdateAI(uint32 /*uiDiff*/)
{
if (!UpdateVictim())
return;
@@ -195,7 +195,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (IsNihil)
{
@@ -468,7 +468,7 @@ public:
OgreGUID = 0;
}
- void UpdateAI(const uint32 /*uiDiff*/) {}
+ void UpdateAI(uint32 /*uiDiff*/) {}
};
};
@@ -528,7 +528,7 @@ public:
}
}
- void UpdateAI(const uint32 /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -654,7 +654,7 @@ class npc_simon_bunny : public CreatureScript
EventMap _events;
std::list<uint8> colorSequence, playableSequence, playerSequence;
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
_events.Update(diff);
@@ -708,7 +708,7 @@ class npc_simon_bunny : public CreatureScript
}
}
- void DoAction(const int32 action)
+ void DoAction(int32 action)
{
switch (action)
{
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 64b484268df..e950547ac30 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -86,7 +86,7 @@ public:
Talk(SAY_SUMMON);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Faction_Timer)
{
@@ -487,7 +487,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
if (uiCheckTimer <= uiDiff)
{
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index edb7a2642d5..fd193aa4835 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -274,7 +274,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
if (!me->getVictim())
@@ -445,7 +445,7 @@ public:
ReleasedFromCage = false;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (ReleasedFromCage)
{
@@ -628,7 +628,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index 769ee7dc68d..e25d5403c02 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -237,7 +237,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (Event_Timer <= diff)
{
@@ -506,7 +506,7 @@ public:
return false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Is event even running?
if (!isEvent)
@@ -784,7 +784,7 @@ public:
// DoCast(me, SPELL_DE_MATERIALIZE);
//}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!Materialize)
{
@@ -997,7 +997,7 @@ public:
player->FailQuest(QUEST_MARK_V_IS_ALIVE);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 0a016f0923c..a0c365a9a96 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -126,7 +126,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (bCanEat || bIsEating)
{
@@ -280,7 +280,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
{
@@ -385,7 +385,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (PoisonTimer)
{
@@ -661,6 +661,7 @@ class npc_karynaku : public CreatureScript
/*####
# npc_overlord_morghor
+# this whole script is wrong and needs a rewrite.even the illidan npc used is the wrong one.npc id 23467 may be the correct one
####*/
enum eOverlordData
{
@@ -766,7 +767,7 @@ public:
Player* player = Unit::GetPlayer(*me, PlayerGUID);
Creature* Illi = Creature::GetCreature(*me, IllidanGUID);
- if (!player || !Illi)
+ if (!player)
{
EnterEvadeMode();
return 0;
@@ -794,14 +795,21 @@ public:
return 2000;
break;
case 5:
- Illi->SetVisible(true);
- Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ if (Illi)
+ {
+ Illi->SetVisible(true);
+ Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ Illi->SetDisplayId(21526);
+ }
return 350;
break;
case 6:
- Illi->CastSpell(Illi, SPELL_ONE, true);
- Illi->SetTarget(me->GetGUID());
- me->SetTarget(IllidanGUID);
+ if (Illi)
+ {
+ Illi->CastSpell(Illi, SPELL_ONE, true);
+ Illi->SetTarget(me->GetGUID());
+ me->SetTarget(IllidanGUID);
+ }
return 2000;
break;
case 7:
@@ -810,10 +818,15 @@ public:
break;
case 8:
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8);
- return 9000;
+ return 2500;
+ break;
+ case 9:
+ // missing text "Lord Illidan, this is the Dragonmaw that I, and others, have told you about. He will lead us to victory!"
+ return 5000;
break;
case 10:
- Illi->AI()->Talk(LORD_ILLIDAN_SAY_1);
+ if (Illi)
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_1);
return 5000;
break;
case 11:
@@ -821,42 +834,53 @@ public:
return 6000;
break;
case 12:
- Illi->AI()->Talk(LORD_ILLIDAN_SAY_2);
+ if (Illi)
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_2);
return 5500;
break;
case 13:
- Illi->AI()->Talk(LORD_ILLIDAN_SAY_3);
+ if (Illi)
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_3);
return 4000;
break;
case 14:
- Illi->SetTarget(PlayerGUID);
+ if (Illi)
+ Illi->SetTarget(PlayerGUID);
return 1500;
break;
case 15:
- Illi->AI()->Talk(LORD_ILLIDAN_SAY_4);
+ if (Illi)
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_4);
return 1500;
break;
case 16:
- Illi->CastSpell(player, SPELL_TWO, true);
+ if (Illi)
+ Illi->CastSpell(player, SPELL_TWO, true);
player->RemoveAurasDueToSpell(SPELL_THREE);
player->RemoveAurasDueToSpell(SPELL_FOUR);
return 5000;
break;
case 17:
- Illi->AI()->Talk(LORD_ILLIDAN_SAY_5);
+ if (Illi)
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_5);
return 5000;
break;
case 18:
- Illi->AI()->Talk(LORD_ILLIDAN_SAY_6);
+ if (Illi)
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_6);
return 5000;
break;
case 19:
- Illi->AI()->Talk(LORD_ILLIDAN_SAY_7);
+ if (Illi)
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_7);
return 5000;
break;
case 20:
- Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
- Illi->SetDisableGravity(true);
+ if (Illi)
+ {
+ Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
+ Illi->SetDisableGravity(true);
+ }
return 500;
break;
case 21:
@@ -864,8 +888,11 @@ public:
return 500;
break;
case 22:
- Illi->SetVisible(false);
- Illi->setDeathState(JUST_DIED);
+ if (Illi)
+ {
+ Illi->SetVisible(false);
+ Illi->setDeathState(JUST_DIED);
+ }
return 1000;
break;
case 23:
@@ -886,7 +913,7 @@ public:
break;
case 27:
{
- Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
+ Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f);
if (Yarzill)
Yarzill->SetTarget(PlayerGUID);
return 500;
@@ -921,9 +948,11 @@ public:
}
break;
case 32:
- me->GetMotionMaster()->MovePoint(0, -5085.77f, 577.231f, 86.6719f); return 5000;
+ me->GetMotionMaster()->MovePoint(0, -5085.77f, 577.231f, 86.6719f);
+ return 5000;
break;
case 33:
+ me->SetTarget(0);
Reset();
return 100;
break;
@@ -933,14 +962,14 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!ConversationTimer)
return;
if (ConversationTimer <= diff)
{
- if (Event && IllidanGUID && PlayerGUID)
+ if (Event && PlayerGUID)
ConversationTimer = NextStep(++Step);
} else ConversationTimer -= diff;
}
@@ -1096,7 +1125,7 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
@@ -1297,7 +1326,7 @@ public:
++AnimationCount;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (AnimationTimer)
{
@@ -1485,7 +1514,7 @@ public:
Announced = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!PlayerGUID || !EventStarted)
return;
@@ -1552,7 +1581,7 @@ public:
CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1946,7 +1975,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (tapped)
{
diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp
index ac26614ae69..14553be0ef4 100644
--- a/src/server/scripts/Outland/zone_shattrath_city.cpp
+++ b/src/server/scripts/Outland/zone_shattrath_city.cpp
@@ -101,7 +101,7 @@ public:
me->RestoreFaction();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -176,7 +176,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -519,7 +519,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (SayTimer <= diff)
{
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index 2b046a7518e..caa31ed472c 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -125,7 +125,7 @@ public:
}
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (CanDoQuest)
{
@@ -244,7 +244,7 @@ public:
void Reset() {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
@@ -416,7 +416,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp
index 319da372bf8..b4899189af5 100644
--- a/src/server/scripts/Outland/zone_zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp
@@ -192,7 +192,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 05fad623114..edda9750709 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1707,68 +1707,6 @@ class spell_gen_damage_reduction_aura : public SpellScriptLoader
}
};
-class spell_gen_luck_of_the_draw : public SpellScriptLoader
-{
- public:
- spell_gen_luck_of_the_draw() : SpellScriptLoader("spell_gen_luck_of_the_draw") { }
-
- class spell_gen_luck_of_the_draw_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript);
-
- bool Load()
- {
- return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
- }
-
- // cheap hax to make it have update calls
- void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
- {
- isPeriodic = true;
- amplitude = 5 * IN_MILLISECONDS;
- }
-
- void Update(AuraEffect* /*effect*/)
- {
- if (Player* owner = GetUnitOwner()->ToPlayer())
- {
- const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(owner->GetGUID());
- LfgDungeonSet::const_iterator itr = dungeons.begin();
-
- if (itr == dungeons.end())
- {
- Remove(AURA_REMOVE_BY_DEFAULT);
- return;
- }
-
-
- LFGDungeonData const* randomDungeon = sLFGMgr->GetLFGDungeon(*itr);
- if (Group* group = owner->GetGroup())
- if (Map const* map = owner->GetMap())
- if (group->isLFGGroup())
- if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
- if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId))
- if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
- if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
- return; // in correct dungeon
-
- Remove(AURA_REMOVE_BY_DEFAULT);
- }
- }
-
- void Register()
- {
- DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_luck_of_the_draw_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_luck_of_the_draw_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- }
- };
-
- AuraScript* GetAuraScript() const
- {
- return new spell_gen_luck_of_the_draw_AuraScript();
- }
-};
-
enum DummyTrigger
{
SPELL_PERSISTANT_SHIELD_TRIGGERED = 26470,
@@ -3518,6 +3456,63 @@ class spell_gen_replenishment : public SpellScriptLoader
}
};
+enum ServiceUniform
+{
+ SPELL_SERVICE_UNIFORM = 71450,
+
+ MODEL_GOBLIN_MALE = 31002,
+ MODEL_GOBLIN_FEMALE = 31003,
+};
+
+class spell_gen_aura_service_uniform : public SpellScriptLoader
+{
+ public:
+ spell_gen_aura_service_uniform() : SpellScriptLoader("spell_gen_aura_service_uniform") { }
+
+ class spell_gen_aura_service_uniform_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_aura_service_uniform_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_SERVICE_UNIFORM))
+ return false;
+ return true;
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ // Apply model goblin
+ Unit* target = GetTarget();
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (target->getGender() == GENDER_MALE)
+ target->SetDisplayId(MODEL_GOBLIN_MALE);
+ else
+ target->SetDisplayId(MODEL_GOBLIN_FEMALE);
+ }
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ target->RestoreDisplayId();
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectRemoveFn(spell_gen_aura_service_uniform_AuraScript::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_gen_aura_service_uniform_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_aura_service_uniform_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3553,7 +3548,6 @@ void AddSC_generic_spell_scripts()
new spell_gen_vehicle_scaling();
new spell_gen_oracle_wolvar_reputation();
new spell_gen_damage_reduction_aura();
- new spell_gen_luck_of_the_draw();
new spell_gen_dummy_trigger();
new spell_gen_spirit_healer_res();
new spell_gen_gadgetzan_transporter_backfire();
@@ -3597,4 +3591,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_bonked();
new spell_gen_gift_of_naaru();
new spell_gen_replenishment();
+ new spell_gen_aura_service_uniform();
}
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index dbfc2b44501..90bb689a9a9 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -368,7 +368,7 @@ class spell_winter_veil_px_238_winter_wondervolt : public SpellScriptLoader
if (target->HasAura(spells[i]))
return;
- GetCaster()->CastSpell(target, spells[urand(0, 3)], true);
+ target->CastSpell(target, spells[urand(0, 3)], true);
}
}
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 877248cf1a8..891a7daaa1f 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -38,7 +38,7 @@ enum HunterSpells
SPELL_HUNTER_CHIMERA_SHOT_SERPENT = 53353,
SPELL_HUNTER_CHIMERA_SHOT_VIPER = 53358,
SPELL_HUNTER_CHIMERA_SHOT_SCORPID = 53359,
- SPELL_HUNTER_GLYPHE_OF_ASPECT_OF_THE_VIPER = 56851,
+ SPELL_HUNTER_GLYPH_OF_ASPECT_OF_THE_VIPER = 56851,
SPELL_HUNTER_INVIGORATION_TRIGGERED = 53398,
SPELL_HUNTER_MASTERS_CALL_TRIGGERED = 62305,
SPELL_HUNTER_MISDIRECTION_PROC = 35079,
@@ -116,7 +116,7 @@ class spell_hun_ascpect_of_the_viper : public SpellScriptLoader
{
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE))
return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_GLYPHE_OF_ASPECT_OF_THE_VIPER))
+ if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_GLYPH_OF_ASPECT_OF_THE_VIPER))
return false;
return true;
}
@@ -128,8 +128,8 @@ class spell_hun_ascpect_of_the_viper : public SpellScriptLoader
uint32 maxMana = GetTarget()->GetMaxPower(POWER_MANA);
int32 mana = CalculatePct(maxMana, GetTarget()->GetAttackTime(RANGED_ATTACK) / 1000.0f);
- if (AuraEffect const* glyphe = GetTarget()->GetAuraEffect(SPELL_HUNTER_GLYPHE_OF_ASPECT_OF_THE_VIPER, EFFECT_0))
- AddPct(mana, glyphe->GetAmount());
+ if (AuraEffect const* glyph = GetTarget()->GetAuraEffect(SPELL_HUNTER_GLYPH_OF_ASPECT_OF_THE_VIPER, EFFECT_0))
+ AddPct(mana, glyph->GetAmount());
GetTarget()->CastCustomSpell(SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE, SPELLVALUE_BASE_POINT0, mana, GetTarget(), true, NULL, aurEff);
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index b8e17f4ecca..c9c75cdb134 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -140,7 +140,7 @@ class spell_item_blessing_of_ancient_kings : public SpellScriptLoader
protEff->SetAmount(std::min<int32>(protEff->GetAmount() + absorb, 20000));
// Refresh and return to prevent replacing the aura
- aurEff->GetBase()->RefreshDuration();
+ protEff->GetBase()->RefreshDuration();
}
else
GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, NULL, aurEff);
@@ -813,53 +813,65 @@ class spell_item_scroll_of_recall : public SpellScriptLoader
enum ShadowsFate
{
SPELL_SOUL_FEAST = 71203,
- QUEST_A_FEAST_OF_SOULS = 24547
};
-class spell_item_shadows_fate : public SpellScriptLoader
+class spell_item_unsated_craving : public SpellScriptLoader
{
public:
- spell_item_shadows_fate() : SpellScriptLoader("spell_item_shadows_fate") { }
+ spell_item_unsated_craving() : SpellScriptLoader("spell_item_unsated_craving") { }
- class spell_item_shadows_fate_AuraScript : public AuraScript
+ class spell_item_unsated_craving_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_item_shadows_fate_AuraScript);
+ PrepareAuraScript(spell_item_unsated_craving_AuraScript);
- bool Validate(SpellInfo const* /*spellInfo*/)
+ bool CheckProc(ProcEventInfo& procInfo)
{
- if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_FEAST))
+ Unit* caster = procInfo.GetActor();
+ if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
return false;
- if (!sObjectMgr->GetQuestTemplate(QUEST_A_FEAST_OF_SOULS))
+
+ Unit* target = procInfo.GetActionTarget();
+ if (!target || target->GetTypeId() != TYPEID_UNIT || target->GetCreatureType() == CREATURE_TYPE_CRITTER || target->isSummon())
return false;
- return true;
- }
- bool Load()
- {
- _procTarget = NULL;
return true;
}
- bool CheckProc(ProcEventInfo& /*eventInfo*/)
+ void Register()
{
- _procTarget = GetCaster();
- return _procTarget && _procTarget->GetTypeId() == TYPEID_PLAYER && _procTarget->ToPlayer()->GetQuestStatus(QUEST_A_FEAST_OF_SOULS) == QUEST_STATUS_INCOMPLETE;
+ DoCheckProc += AuraCheckProcFn(spell_item_unsated_craving_AuraScript::CheckProc);
}
+ };
- void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_item_unsated_craving_AuraScript();
+ }
+};
+
+class spell_item_shadows_fate : public SpellScriptLoader
+{
+ public:
+ spell_item_shadows_fate() : SpellScriptLoader("spell_item_shadows_fate") { }
+
+ class spell_item_shadows_fate_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_item_shadows_fate_AuraScript);
+
+ void HandleProc(ProcEventInfo& procInfo)
{
- PreventDefaultAction();
- GetTarget()->CastSpell(_procTarget, SPELL_SOUL_FEAST, true);
+ Unit* caster = procInfo.GetActor();
+ Unit* target = GetCaster();
+ if (!caster || !target)
+ return;
+
+ caster->CastSpell(target, SPELL_SOUL_FEAST, TRIGGERED_FULL_MASK);
}
void Register()
{
- DoCheckProc += AuraCheckProcFn(spell_item_shadows_fate_AuraScript::CheckProc);
- OnEffectProc += AuraEffectProcFn(spell_item_shadows_fate_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
+ OnProc += AuraProcFn(spell_item_shadows_fate_AuraScript::HandleProc);
}
-
- private:
- Unit* _procTarget;
};
AuraScript* GetAuraScript() const
@@ -2481,6 +2493,7 @@ void AddSC_item_spell_scripts()
new spell_item_piccolo_of_the_flaming_fire();
new spell_item_savory_deviate_delight();
new spell_item_scroll_of_recall();
+ new spell_item_unsated_craving();
new spell_item_shadows_fate();
new spell_item_shadowmourne();
new spell_item_shadowmourne_soul_fragment();
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index e19110d0f62..4e86a895484 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -31,8 +31,8 @@ enum PriestSpells
{
SPELL_PRIEST_DIVINE_AEGIS = 47753,
SPELL_PRIEST_EMPOWERED_RENEW = 63544,
- SPELL_PRIEST_GLYPHE_OF_LIGHTWELL = 55673,
- SPELL_PRIEST_GLYPHE_OF_PRAYER_OF_HEALING_HEAL = 56161,
+ SPELL_PRIEST_GLYPH_OF_LIGHTWELL = 55673,
+ SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL = 56161,
SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL = 48153,
SPELL_PRIEST_MANA_LEECH_PROC = 34650,
SPELL_PRIEST_PENANCE_R1 = 47540,
@@ -114,7 +114,7 @@ class spell_pri_glyph_of_prayer_of_healing : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/)
{
- if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPHE_OF_PRAYER_OF_HEALING_HEAL))
+ if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL))
return false;
return true;
}
@@ -123,9 +123,9 @@ class spell_pri_glyph_of_prayer_of_healing : public SpellScriptLoader
{
PreventDefaultAction();
- SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPHE_OF_PRAYER_OF_HEALING_HEAL);
+ SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL);
int32 heal = int32(CalculatePct(int32(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks());
- GetTarget()->CastCustomSpell(SPELL_PRIEST_GLYPHE_OF_PRAYER_OF_HEALING_HEAL, SPELLVALUE_BASE_POINT0, heal, eventInfo.GetProcTarget(), true, NULL, aurEff);
+ GetTarget()->CastCustomSpell(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, SPELLVALUE_BASE_POINT0, heal, eventInfo.GetProcTarget(), true, NULL, aurEff);
}
void Register()
@@ -212,7 +212,7 @@ class spell_pri_lightwell_renew : public SpellScriptLoader
if (Unit* caster = GetCaster())
{
// Bonus from Glyph of Lightwell
- if (AuraEffect* modHealing = caster->GetAuraEffect(SPELL_PRIEST_GLYPHE_OF_LIGHTWELL, EFFECT_0))
+ if (AuraEffect* modHealing = caster->GetAuraEffect(SPELL_PRIEST_GLYPH_OF_LIGHTWELL, EFFECT_0))
AddPct(amount, modHealing->GetAmount());
}
}
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index b69295150c2..f970807bb94 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -296,9 +296,9 @@ class spell_sha_earth_shield : public SpellScriptLoader
// Glyph of Earth Shield
//! WORKAROUND
- //! this glyphe is a proc
- if (AuraEffect* glyphe = caster->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_EARTH_SHIELD, EFFECT_0))
- AddPct(amount, glyphe->GetAmount());
+ //! this glyph is a proc
+ if (AuraEffect* glyph = caster->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_EARTH_SHIELD, EFFECT_0))
+ AddPct(amount, glyph->GetAmount());
}
}
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 78bfcbab6a0..a9a4b2d749a 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -38,7 +38,7 @@ enum WarlockSpells
SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER = 54509,
SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444,
SPELL_WARLOCK_FEL_SYNERGY_HEAL = 54181,
- SPELL_WARLOCK_GLYPHE_OF_SIPHON_LIFE = 63106,
+ SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE = 63106,
SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692,
SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693,
SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703,
@@ -746,7 +746,7 @@ class spell_warl_siphon_life : public SpellScriptLoader
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SIPHON_LIFE_HEAL))
return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPHE_OF_SIPHON_LIFE))
+ if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE))
return false;
return true;
}
@@ -762,8 +762,8 @@ class spell_warl_siphon_life : public SpellScriptLoader
int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()));
// Glyph of Siphon Life
- if (AuraEffect const* glyphe = GetTarget()->GetAuraEffect(SPELL_WARLOCK_GLYPHE_OF_SIPHON_LIFE, EFFECT_0))
- AddPct(amount, glyphe->GetAmount());
+ if (AuraEffect const* glyph = GetTarget()->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE, EFFECT_0))
+ AddPct(amount, glyph->GetAmount());
GetTarget()->CastCustomSpell(SPELL_WARLOCK_SIPHON_LIFE_HEAL, SPELLVALUE_BASE_POINT0, amount, GetTarget(), true, NULL, aurEff);
}
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 41a32185620..d0ffe5214db 100644
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -315,6 +315,30 @@ class achievement_not_even_a_scratch : public AchievementCriteriaScript
}
};
+enum FlirtWithDisaster
+{
+ AURA_PERFUME_FOREVER = 70235,
+ AURA_PERFUME_ENCHANTRESS = 70234,
+ AURA_PERFUME_VICTORY = 70233,
+};
+
+class achievement_flirt_with_disaster_perf_check : public AchievementCriteriaScript
+{
+ public:
+ achievement_flirt_with_disaster_perf_check() : AchievementCriteriaScript("achievement_flirt_with_disaster_perf_check") { }
+
+ bool OnCheck(Player* player, Unit* /*target*/)
+ {
+ if (!player)
+ return false;
+
+ if (player->HasAura(AURA_PERFUME_FOREVER) || player->HasAura(AURA_PERFUME_ENCHANTRESS) || player->HasAura(AURA_PERFUME_VICTORY))
+ return true;
+
+ return false;
+ }
+};
+
void AddSC_achievement_scripts()
{
new achievement_resilient_victory();
@@ -333,4 +357,5 @@ void AddSC_achievement_scripts()
new achievement_bg_sa_defense_of_ancients();
new achievement_tilted();
new achievement_not_even_a_scratch();
+ new achievement_flirt_with_disaster_perf_check();
}
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index c031c4a3b4d..83fac35b1b6 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -425,6 +425,69 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
std::map<uint32, time_t> _triggerTimes;
};
+/*######
+ ## at_frostgrips_hollow
+ ######*/
+
+enum FrostgripsHollow
+{
+ QUEST_THE_LONESOME_WATCHER = 12877,
+
+ NPC_STORMFORGED_MONITOR = 29862,
+ NPC_STORMFORGED_ERADICTOR = 29861,
+
+ TYPE_WAYPOINT = 0,
+ DATA_START = 0
+};
+
+Position const stormforgedMonitorPosition = {6963.95f, 45.65f, 818.71f, 4.948f};
+Position const stormforgedEradictorPosition = {6983.18f, 7.15f, 806.33f, 2.228f};
+
+class AreaTrigger_at_frostgrips_hollow : public AreaTriggerScript
+{
+public:
+ AreaTrigger_at_frostgrips_hollow() : AreaTriggerScript("at_frostgrips_hollow")
+ {
+ stormforgedMonitorGUID = 0;
+ stormforgedEradictorGUID = 0;
+ }
+
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /* trigger */)
+ {
+ if (player->GetQuestStatus(QUEST_THE_LONESOME_WATCHER) != QUEST_STATUS_INCOMPLETE)
+ return false;
+
+ Creature* stormforgedMonitor = Creature::GetCreature(*player, stormforgedMonitorGUID);
+ if (stormforgedMonitor)
+ return false;
+
+ Creature* stormforgedEradictor = Creature::GetCreature(*player, stormforgedEradictorGUID);
+ if (stormforgedEradictor)
+ return false;
+
+ if ((stormforgedMonitor = player->SummonCreature(NPC_STORMFORGED_MONITOR, stormforgedMonitorPosition, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)))
+ {
+ stormforgedMonitorGUID = stormforgedMonitor->GetGUID();
+ stormforgedMonitor->SetWalk(false);
+ /// The npc would search an alternative way to get to the last waypoint without this unit state.
+ stormforgedMonitor->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING);
+ stormforgedMonitor->GetMotionMaster()->MovePath(NPC_STORMFORGED_MONITOR * 100, false);
+ }
+
+ if ((stormforgedEradictor = player->SummonCreature(NPC_STORMFORGED_ERADICTOR, stormforgedEradictorPosition, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)))
+ {
+ stormforgedEradictorGUID = stormforgedEradictor->GetGUID();
+ stormforgedEradictor->GetMotionMaster()->MovePath(NPC_STORMFORGED_ERADICTOR * 100, false);
+ }
+
+ return true;
+ }
+
+private:
+ uint64 stormforgedMonitorGUID;
+ uint64 stormforgedEradictorGUID;
+};
+
void AddSC_areatrigger_scripts()
{
new AreaTrigger_at_coilfang_waterfall();
@@ -436,4 +499,5 @@ void AddSC_areatrigger_scripts()
new AreaTrigger_at_nats_landing();
new AreaTrigger_at_brewfest();
new AreaTrigger_at_area_52_entrance();
+ new AreaTrigger_at_frostgrips_hollow();
}
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index 7699712a1e4..41508a80241 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -113,7 +113,7 @@ struct emerald_dragonAI : public WorldBossAI
}
// Execute and reschedule base events shared between all Emerald Dragons
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -137,7 +137,7 @@ struct emerald_dragonAI : public WorldBossAI
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -177,7 +177,7 @@ class npc_dream_fog : public CreatureScript
_roamTimer = 0;
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -275,7 +275,7 @@ class boss_ysondre : public CreatureScript
}
}
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -370,7 +370,7 @@ class boss_lethon : public CreatureScript
}
}
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -490,7 +490,7 @@ class boss_emeriss : public CreatureScript
}
}
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -604,7 +604,7 @@ class boss_taerar : public CreatureScript
}
}
- void ExecuteEvent(uint32 const eventId)
+ void ExecuteEvent(uint32 eventId)
{
switch (eventId)
{
@@ -622,7 +622,7 @@ class boss_taerar : public CreatureScript
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!me->isInCombat())
return;
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index f07a9ed7671..bff30f6cca5 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -70,7 +70,7 @@ public:
DoCast(who, spell->Id);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Always decrease our global cooldown first
if (globalCooldown > diff)
@@ -273,7 +273,7 @@ public:
canTeleport = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -338,7 +338,7 @@ public:
canTeleport = false;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index 174ba8870d1..d0ac142e050 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -55,7 +55,7 @@ public:
IsSelfRooted = true;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
//Always decrease our global cooldown first
if (GlobalCooldown > diff)
@@ -186,7 +186,7 @@ public:
uint32 timer, interval;
const SpellInfo* spell;
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (timer <= diff)
{
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 8a3342cf2de..af2a3b5f84c 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -344,7 +344,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
// Reset flags after a certain time has passed so that the next player has to start the 'event' again
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
@@ -444,7 +444,7 @@ public:
me->SendMessageToSet(&data, true);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!Active)
{
@@ -689,7 +689,7 @@ public:
}
}
- void UpdateAI(uint32 const diff);
+ void UpdateAI(uint32 diff);
void EnterCombat(Unit* /*who*/){}
};
@@ -798,7 +798,7 @@ public:
}
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
//lower HP on every world tick makes it a useful counter, not officlone though
if (me->isAlive() && me->GetHealth() > 6)
@@ -824,7 +824,7 @@ public:
}
};
-void npc_doctor::npc_doctorAI::UpdateAI(uint32 const diff)
+void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff)
{
if (Event && SummonPatientCount >= 20)
{
@@ -1056,7 +1056,7 @@ public:
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (CanRun && !me->isInCombat())
{
@@ -1128,7 +1128,7 @@ public:
{
}
- void UpdateAI(uint32 const /*diff*/)
+ void UpdateAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -1540,7 +1540,7 @@ public:
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (ExplosionTimer <= diff)
{
@@ -1656,7 +1656,7 @@ public:
}
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -1734,7 +1734,7 @@ public:
void EnterCombat(Unit* /*who*/){}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (me->HasAura(20372))
{
@@ -1921,7 +1921,7 @@ public:
despawnTimer = 4 * IN_MILLISECONDS;
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (despawnTimer > 0)
{
@@ -1981,10 +1981,11 @@ class npc_training_dummy : public CreatureScript
public:
npc_training_dummy() : CreatureScript("npc_training_dummy") { }
- struct npc_training_dummyAI : Scripted_NoMovementAI
+ struct npc_training_dummyAI : ScriptedAI
{
- npc_training_dummyAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ npc_training_dummyAI(Creature* creature) : ScriptedAI(creature)
{
+ SetCombatMovement(false);
entry = creature->GetEntry();
}
@@ -2015,13 +2016,7 @@ public:
damage = 0;
}
- void EnterCombat(Unit* /*who*/)
- {
- if (entry != NPC_ADVANCED_TARGET_DUMMY && entry != NPC_TARGET_DUMMY)
- return;
- }
-
- void UpdateAI(uint32 const diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -2115,7 +2110,7 @@ public:
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -2179,7 +2174,7 @@ public:
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
@@ -2909,14 +2904,14 @@ public:
void EnterCombat(Unit* /*who*/) { }
- void DoAction(const int32 /*param*/)
+ void DoAction(int32 /*param*/)
{
inLove = true;
if (Unit* owner = me->GetOwner())
owner->CastSpell(owner, SPELL_SPRING_FLING, true);
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 diff)
{
if (inLove)
{
diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h
index d0c3490bc2d..f4e4ce7fe06 100644
--- a/src/server/shared/Common.h
+++ b/src/server/shared/Common.h
@@ -116,7 +116,7 @@
#define I32FMT "%08I32X"
#define I64FMT "%016I64X"
#define snprintf _snprintf
-#define atoll __atoi64
+#define atoll _atoi64
#define vsnprintf _vsnprintf
#define finite(X) _finite(X)
#define llabs _abs64
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index 9f93e99ab26..fa02b1d369a 100644
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -77,7 +77,8 @@ class DatabaseWorkerPool
{
T* t = new T(_queue, _connectionInfo);
res &= t->Open();
- WPFatal (mysql_get_server_version(t->GetHandle()) >= MIN_MYSQL_SERVER_VERSION, "TrinityCore does not support MySQL versions below 5.1");
+ if (res) // only check mysql version if connection is valid
+ WPFatal(mysql_get_server_version(t->GetHandle()) >= MIN_MYSQL_SERVER_VERSION, "TrinityCore does not support MySQL versions below 5.1");
_connections[IDX_ASYNC][i] = t;
++_connectionCount[IDX_ASYNC];
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 1c2410b8b53..f4da15aefa3 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -101,6 +101,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_SEL_CHARACTER_SPELLCOOLDOWNS, "SELECT spell, item, time FROM character_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_CHARACTER_DECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_GUILD_MEMBER, "SELECT guildid, rank FROM guild_member WHERE guid = ?", CONNECTION_BOTH);
+ PrepareStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED, "SELECT g.guildid, g.name, gr.rname, gm.pnote, gm.offnote "
+ "FROM guild g JOIN guild_member gm ON g.guildid = gm.guildid "
+ "JOIN guild_rank gr ON g.guildid = gr.guildid AND gm.rank = gr.rid WHERE gm.guid = ?", CONNECTION_BOTH);
PrepareStatement(CHAR_SEL_CHARACTER_ACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_CHARACTER_CRITERIAPROGRESS, "SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_CHARACTER_EQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, "
@@ -144,6 +147,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, randomPropertyId = ?, durability = ?, playedTime = ?, text = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_ITEM_INSTANCE_ON_LOAD, "UPDATE item_instance SET duration = ?, flags = ?, durability = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_ITEM_INSTANCE, "DELETE FROM item_instance WHERE guid = ?", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER, "DELETE FROM item_instance WHERE owner_guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_GIFT_OWNER, "UPDATE character_gifts SET guid = ? WHERE item_guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_GIFT, "DELETE FROM character_gifts WHERE item_guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM, "SELECT entry, flags FROM character_gifts WHERE item_guid = ?", CONNECTION_SYNCH);
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index e4728e19934..4c5f5d27899 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -105,6 +105,7 @@ enum CharacterDatabaseStatements
CHAR_SEL_CHARACTER_SPELLCOOLDOWNS,
CHAR_SEL_CHARACTER_DECLINEDNAMES,
CHAR_SEL_GUILD_MEMBER,
+ CHAR_SEL_GUILD_MEMBER_EXTENDED,
CHAR_SEL_CHARACTER_ARENAINFO,
CHAR_SEL_CHARACTER_ACHIEVEMENTS,
CHAR_SEL_CHARACTER_CRITERIAPROGRESS,
@@ -144,6 +145,7 @@ enum CharacterDatabaseStatements
CHAR_UPD_ITEM_INSTANCE,
CHAR_UPD_ITEM_INSTANCE_ON_LOAD,
CHAR_DEL_ITEM_INSTANCE,
+ CHAR_DEL_ITEM_INSTANCE_BY_OWNER,
CHAR_UPD_GIFT_OWNER,
CHAR_DEL_GIFT,
CHAR_SEL_CHARACTER_GIFT_BY_ITEM,
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index 70d509af6fe..a23294a038c 100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -22,11 +22,11 @@ void LoginDatabaseConnection::DoPrepareStatements()
if (!m_reconnecting)
m_stmts.resize(MAX_LOGINDATABASE_STATEMENTS);
- PrepareStatement(LOGIN_SEL_REALMLIST, "SELECT id, name, address, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE flag <> 3 ORDER BY name", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_SEL_REALMLIST, "SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE flag <> 3 ORDER BY name", CONNECTION_SYNCH);
PrepareStatement(LOGIN_DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_IP_BANNED, "SELECT * FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH);
- PrepareStatement(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban')", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban')", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_IP_BANNED_ALL, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) ORDER BY unbandate", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_IP_BANNED_BY_IP, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) AND ip LIKE CONCAT('%%', ?, '%%') ORDER BY unbandate", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED, "SELECT bandate, unbandate FROM account_banned WHERE id = ? AND active = 1", CONNECTION_SYNCH);
@@ -42,12 +42,12 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?", CONNECTION_SYNCH);
- PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT id, sessionkey, last_ip, locked, v, s, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ?", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL, "SELECT id, username FROM account WHERE email = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_NUM_CHARS_ON_REALM, "SELECT numchars FROM realmcharacters WHERE realmid = ? AND acctid= ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_BY_IP, "SELECT id, username FROM account WHERE last_ip = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_BY_ID, "SELECT 1 FROM account WHERE id = ?", CONNECTION_SYNCH);
- PrepareStatement(LOGIN_INS_IP_BANNED, "INSERT INTO ip_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_INS_IP_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_DEL_IP_NOT_BANNED, "DELETE FROM ip_banned WHERE ip = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_INS_ACCOUNT_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED, "UPDATE account_banned SET active = 0 WHERE id = ? AND active != 0", CONNECTION_ASYNC);
@@ -55,14 +55,15 @@ 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_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_SYNCH);
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_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
- PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_UPD_MUTE_TIME_LOGIN, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_LAST_IP, "UPDATE account SET last_ip = ? WHERE username = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_ACCOUNT_ONLINE, "UPDATE account SET online = 1 WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_UPTIME_PLAYERS, "UPDATE uptime SET uptime = ?, maxplayers = ? WHERE realmid = ? AND starttime = ?", CONNECTION_ASYNC);
@@ -76,7 +77,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_GET_USERNAME_BY_ID, "SELECT username FROM account WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_CHECK_PASSWORD, "SELECT 1 FROM account WHERE id = ? AND sha_pass_hash = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_CHECK_PASSWORD_BY_NAME, "SELECT 1 FROM account WHERE username = ? AND sha_pass_hash = ?", CONNECTION_SYNCH);
- PrepareStatement(LOGIN_SEL_PINFO, "SELECT a.username, aa.gmlevel, a.email, a.last_ip, DATE_FORMAT(a.last_login, '%Y-%m-%d %T'), a.mutetime FROM account a LEFT JOIN account_access aa ON (a.id = aa.id AND (aa.RealmID = ? OR aa.RealmID = -1)) WHERE a.id = ?", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_SEL_PINFO, "SELECT a.username, aa.gmlevel, a.email, a.last_ip, DATE_FORMAT(a.last_login, '%Y-%m-%d %T'), a.mutetime, a.mutereason, a.muteby FROM account a LEFT JOIN account_access aa ON (a.id = aa.id AND (aa.RealmID = ? OR aa.RealmID = -1)) WHERE a.id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_PINFO_BANS, "SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned WHERE id = ? AND active ORDER BY bandate ASC LIMIT 1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_GM_ACCOUNTS, "SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= ? AND (aa.realmid = -1 OR aa.realmid = ?)", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_INFO, "SELECT a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.id = ?", CONNECTION_SYNCH);
@@ -87,4 +88,18 @@ 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_ACCOUNT_ACCESS_BY_ID, "SELECT gmlevel, RealmID FROM account_access WHERE id = ? and (RealmID = ? OR RealmID = -1) ORDER BY gmlevel desc", CONNECTION_SYNCH);
+
+ PrepareStatement(LOGIN_SEL_RBAC_ACCOUNT_GROUPS, "SELECT groupId FROM rbac_account_groups WHERE accountId = ? AND (realmId = ? OR realmId = -1) GROUP BY groupId", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_INS_RBAC_ACCOUNT_GROUP, "INSERT INTO rbac_account_groups (accountId, groupId, realmId) VALUES (?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_DEL_RBAC_ACCOUNT_GROUP, "DELETE FROM rbac_account_groups WHERE accountId = ? AND groupId = ? AND (realmId = ? OR realmId = -1)", CONNECTION_ASYNC);
+
+ PrepareStatement(LOGIN_SEL_RBAC_ACCOUNT_ROLES, "SELECT roleId, granted FROM rbac_account_roles WHERE accountId = ? AND (realmId = ? OR realmId = -1) ORDER BY roleId, realmId", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_INS_RBAC_ACCOUNT_ROLE, "INSERT INTO rbac_account_roles (accountId, roleId, granted, realmId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE granted = VALUES(granted)", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_DEL_RBAC_ACCOUNT_ROLE, "DELETE FROM rbac_account_roles WHERE accountId = ? AND roleId = ? AND (realmId = ? OR realmId = -1)", CONNECTION_ASYNC);
+
+ PrepareStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS, "SELECT permissionId, granted FROM rbac_account_permissions WHERE accountId = ? AND (realmId = ? OR realmId = -1) ORDER BY permissionId, realmId", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_INS_RBAC_ACCOUNT_PERMISSION, "INSERT INTO rbac_account_permissions (accountId, permissionId, granted, realmId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE granted = VALUES(granted)", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_DEL_RBAC_ACCOUNT_PERMISSION, "DELETE FROM rbac_account_permissions WHERE accountId = ? AND permissionId = ? AND (realmId = ? OR realmId = -1)", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h
index 798016d553d..939cc4b4790 100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.h
+++ b/src/server/shared/Database/Implementation/LoginDatabase.h
@@ -83,6 +83,7 @@ enum LoginDatabaseStatements
LOGIN_UPD_USERNAME,
LOGIN_UPD_PASSWORD,
LOGIN_UPD_MUTE_TIME,
+ LOGIN_UPD_MUTE_TIME_LOGIN,
LOGIN_UPD_LAST_IP,
LOGIN_UPD_ACCOUNT_ONLINE,
LOGIN_UPD_UPTIME_PLAYERS,
@@ -108,6 +109,16 @@ enum LoginDatabaseStatements
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
LOGIN_DEL_ACCOUNT,
+ LOGIN_SEL_ACCOUNT_ACCESS_BY_ID,
+ LOGIN_SEL_RBAC_ACCOUNT_GROUPS,
+ LOGIN_INS_RBAC_ACCOUNT_GROUP,
+ LOGIN_DEL_RBAC_ACCOUNT_GROUP,
+ LOGIN_SEL_RBAC_ACCOUNT_ROLES,
+ LOGIN_INS_RBAC_ACCOUNT_ROLE,
+ LOGIN_DEL_RBAC_ACCOUNT_ROLE,
+ LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS,
+ LOGIN_INS_RBAC_ACCOUNT_PERMISSION,
+ LOGIN_DEL_RBAC_ACCOUNT_PERMISSION,
MAX_LOGINDATABASE_STATEMENTS
};
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index b807736f47b..89f3cf8fdce 100644
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH);
- PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index 10ff16b5ddd..ce23f4ca4f6 100644
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -124,8 +124,9 @@ bool MySQLConnection::Open()
{
sLog->outInfo(LOG_FILTER_SQL, "MySQL client library: %s", mysql_get_client_info());
sLog->outInfo(LOG_FILTER_SQL, "MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
- if (mysql_get_server_version(m_Mysql) != mysql_get_client_version())
- sLog->outInfo(LOG_FILTER_SQL, "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
+ // MySQL version above 5.1 IS required in both client and server and there is no known issue with different versions above 5.1
+ // if (mysql_get_server_version(m_Mysql) != mysql_get_client_version())
+ // sLog->outInfo(LOG_FILTER_SQL, "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
}
sLog->outInfo(LOG_FILTER_SQL, "Connected to MySQL database at %s", m_connectionInfo.host.c_str());
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index 96a115f8057..ea9ab096dcd 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -193,154 +193,125 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax)
{
// Windows NT product family.
case VER_PLATFORM_WIN32_NT:
+ {
+ #if WINVER < 0x0500
+ BYTE suiteMask = osvi.wReserved[0];
+ BYTE productType = osvi.wReserved[1];
+ #else
+ WORD suiteMask = osvi.wSuiteMask;
+ BYTE productType = osvi.wProductType;
+ #endif // WINVER < 0x0500
+
// Test for the specific product family.
if (osvi.dwMajorVersion == 6)
{
- #if WINVER < 0x0500
- if (osvi.wReserved[1] == VER_NT_WORKSTATION)
- #else
- if (osvi.wProductType == VER_NT_WORKSTATION)
- #endif // WINVER < 0x0500
+ if (productType == VER_NT_WORKSTATION)
{
- if (osvi.dwMinorVersion == 1)
+ if (osvi.dwMinorVersion == 2)
+ _tcsncat(szVersion, _T("Windows 8 "), cntMax);
+ else if (osvi.dwMinorVersion == 1)
_tcsncat(szVersion, _T("Windows 7 "), cntMax);
else
_tcsncat(szVersion, _T("Windows Vista "), cntMax);
}
+ else if (osvi.dwMinorVersion == 2)
+ _tcsncat(szVersion, _T("Windows Server 2012 "), cntMax);
else if (osvi.dwMinorVersion == 1)
_tcsncat(szVersion, _T("Windows Server 2008 R2 "), cntMax);
else
_tcsncat(szVersion, _T("Windows Server 2008 "), cntMax);
}
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
+ else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
_tcsncat(szVersion, _T("Microsoft Windows Server 2003 "), cntMax);
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
+ else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
_tcsncat(szVersion, _T("Microsoft Windows XP "), cntMax);
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
+ else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
_tcsncat(szVersion, _T("Microsoft Windows 2000 "), cntMax);
- if (osvi.dwMajorVersion <= 4)
+ else if (osvi.dwMajorVersion <= 4)
_tcsncat(szVersion, _T("Microsoft Windows NT "), cntMax);
// Test for specific product on Windows NT 4.0 SP6 and later.
if (bOsVersionInfoEx)
{
// Test for the workstation type.
- #if WINVER < 0x0500
- if (osvi.wReserved[1] == VER_NT_WORKSTATION)
- #else
- if (osvi.wProductType == VER_NT_WORKSTATION)
- #endif // WINVER < 0x0500
- {
- if (osvi.dwMajorVersion == 4)
- _tcsncat(szVersion, _T("Workstation 4.0 "), cntMax);
- #if WINVER < 0x0500
- else if (osvi.wReserved[0] & VER_SUITE_PERSONAL)
- #else
- else if (osvi.wSuiteMask & VER_SUITE_PERSONAL)
- #endif // WINVER < 0x0500
+ if (productType == VER_NT_WORKSTATION)
+ {
+ if (osvi.dwMajorVersion == 4)
+ _tcsncat(szVersion, _T("Workstation 4.0 "), cntMax);
+ else if (suiteMask & VER_SUITE_PERSONAL)
_tcsncat(szVersion, _T("Home Edition "), cntMax);
- #if WINVER < 0x0500
- else if (osvi.wReserved[0] & VER_SUITE_EMBEDDEDNT)
- #else
- else if (osvi.wSuiteMask & VER_SUITE_EMBEDDEDNT)
- #endif // WINVER < 0x0500
+ else if (suiteMask & VER_SUITE_EMBEDDEDNT)
_tcsncat(szVersion, _T("Embedded "), cntMax);
- else
- _tcsncat(szVersion, _T("Professional "), cntMax);
- }
- // Test for the server type.
- #if WINVER < 0x0500
- else if (osvi.wReserved[1] == VER_NT_SERVER)
- #else
- else if (osvi.wProductType == VER_NT_SERVER)
- #endif // WINVER < 0x0500
- {
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
+ else
+ _tcsncat(szVersion, _T("Professional "), cntMax);
+ }
+ // Test for the server type.
+ else if (productType == VER_NT_SERVER)
{
- #if WINVER < 0x0500
- if (osvi.wReserved[0] & VER_SUITE_DATACENTER)
- #else
- if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
- #endif // WINVER < 0x0500
+ if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
+ {
+ if (suiteMask & VER_SUITE_DATACENTER)
_tcsncat(szVersion, _T("Datacenter Edition "), cntMax);
- #if WINVER < 0x0500
- else if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE)
- #else
- else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
- #endif // WINVER < 0x0500
+ else if (suiteMask & VER_SUITE_ENTERPRISE)
_tcsncat(szVersion, _T("Enterprise Edition "), cntMax);
- #if WINVER < 0x0500
- else if (osvi.wReserved[0] == VER_SUITE_BLADE)
- #else
- else if (osvi.wSuiteMask == VER_SUITE_BLADE)
- #endif // WINVER < 0x0500
+ else if (suiteMask == VER_SUITE_BLADE)
_tcsncat(szVersion, _T("Web Edition "), cntMax);
- else
- _tcsncat(szVersion, _T("Standard Edition "), cntMax);
- }
- else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
- {
- #if WINVER < 0x0500
- if (osvi.wReserved[0] & VER_SUITE_DATACENTER)
- #else
- if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
- #endif // WINVER < 0x0500
+ else
+ _tcsncat(szVersion, _T("Standard Edition "), cntMax);
+ }
+ else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
+ {
+ if (suiteMask & VER_SUITE_DATACENTER)
_tcsncat(szVersion, _T("Datacenter Server "), cntMax);
- #if WINVER < 0x0500
- else if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE)
- #else
- else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
- #endif // WINVER < 0x0500
+ else if (suiteMask & VER_SUITE_ENTERPRISE)
_tcsncat(szVersion, _T("Advanced Server "), cntMax);
- else
- _tcsncat(szVersion, _T("Server "), cntMax);
- }
- else // Windows NT 4.0
- {
- #if WINVER < 0x0500
- if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE)
- #else
- if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
- #endif // WINVER < 0x0500
+ else
+ _tcsncat(szVersion, _T("Server "), cntMax);
+ }
+ else // Windows NT 4.0
+ {
+ if (suiteMask & VER_SUITE_ENTERPRISE)
_tcsncat(szVersion, _T("Server 4.0, Enterprise Edition "), cntMax);
- else
- _tcsncat(szVersion, _T("Server 4.0 "), cntMax);
+ else
+ _tcsncat(szVersion, _T("Server 4.0 "), cntMax);
+ }
}
}
- }
- // Display service pack (if any) and build number.
- if (osvi.dwMajorVersion == 4 && _tcsicmp(osvi.szCSDVersion, _T("Service Pack 6")) == 0)
- {
- HKEY hKey;
- LONG lRet;
- // Test for SP6 versus SP6a.
- lRet = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"), 0, KEY_QUERY_VALUE, &hKey);
- if (lRet == ERROR_SUCCESS)
+ // Display service pack (if any) and build number.
+ if (osvi.dwMajorVersion == 4 && _tcsicmp(osvi.szCSDVersion, _T("Service Pack 6")) == 0)
{
- _stprintf(wszTmp, _T("Service Pack 6a (Version %d.%d, Build %d)"),
- osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
- _tcsncat(szVersion, wszTmp, cntMax);
+ HKEY hKey;
+ LONG lRet;
+
+ // Test for SP6 versus SP6a.
+ lRet = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"), 0, KEY_QUERY_VALUE, &hKey);
+ if (lRet == ERROR_SUCCESS)
+ {
+ _stprintf(wszTmp, _T("Service Pack 6a (Version %d.%d, Build %d)"),
+ osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
+ _tcsncat(szVersion, wszTmp, cntMax);
+ }
+ else // Windows NT 4.0 prior to SP6a
+ {
+ _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"),
+ osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
+ _tcsncat(szVersion, wszTmp, cntMax);
+ }
+ ::RegCloseKey(hKey);
}
- else // Windows NT 4.0 prior to SP6a
+ else // Windows NT 3.51 and earlier or Windows 2000 and later
{
- _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"),
- osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
+ if (!_tcslen(osvi.szCSDVersion))
+ _stprintf(wszTmp, _T("(Version %d.%d, Build %d)"),
+ osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
+ else
+ _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"),
+ osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
_tcsncat(szVersion, wszTmp, cntMax);
}
- ::RegCloseKey(hKey);
- }
- else // Windows NT 3.51 and earlier or Windows 2000 and later
- {
- if (!_tcslen(osvi.szCSDVersion))
- _stprintf(wszTmp, _T("(Version %d.%d, Build %d)"),
- osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
- else
- _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"),
- osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
- _tcsncat(szVersion, wszTmp, cntMax);
+ break;
}
- break;
default:
_stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"),
osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp
index 1ed6350f813..93d53bcc30d 100644
--- a/src/server/shared/Logging/AppenderFile.cpp
+++ b/src/server/shared/Logging/AppenderFile.cpp
@@ -20,6 +20,7 @@
AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags, uint64 fileSize):
Appender(id, name, APPENDER_FILE, level, _flags),
+ logfile(NULL),
filename(_filename),
logDir(_logDir),
mode(_mode),
@@ -47,7 +48,7 @@ void AppenderFile::_write(LogMessage const& message)
snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1.c_str());
logfile = OpenFile(namebuf, mode, backup || exceedMaxSize);
}
- else if (exceedMaxSize)
+ else if (exceedMaxSize)
logfile = OpenFile(filename, "w", true);
if (!logfile)
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 920ce4ce570..f0275f8c6b2 100644
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -286,7 +286,10 @@ void Log::write(LogMessage* msg)
if (worker)
worker->enqueue(new LogOperation(logger, msg));
else
+ {
logger->write(*msg);
+ delete msg;
+ }
}
std::string Log::GetTimestampStr()
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 22dad8d7dd1..bf2980aa45d 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -381,6 +381,8 @@ class ByteBuffer
return *this;
}
+ uint8 * contents() { return &_storage[0]; }
+
const uint8 *contents() const { return &_storage[0]; }
size_t size() const { return _storage.size(); }
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 0d9314c48a3..1bba3c2db09 100644
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -22,7 +22,6 @@
#include "SFMT.h"
#include "Errors.h" // for ASSERT
#include <ace/TSS_T.h>
-#include <ace/INET_Addr.h>
typedef ACE_TSS<SFMTRand> SFMTRandTSS;
static SFMTRandTSS sfmtRand;
@@ -239,6 +238,21 @@ bool IsIPAddress(char const* ipaddress)
return inet_addr(ipaddress) != INADDR_NONE;
}
+std::string GetAddressString(ACE_INET_Addr const& addr)
+{
+ char buf[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
+ addr.addr_to_string(buf, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16);
+ return buf;
+}
+
+bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask)
+{
+ uint32 mask = subnetMask.get_ip_address();
+ if ((net.get_ip_address() & mask) == (addr.get_ip_address() & mask))
+ return true;
+ return false;
+}
+
/// create PID file
uint32 CreatePIDFile(const std::string& filename)
{
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index e7218d7ba72..a379bfd32fc 100644
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -25,6 +25,7 @@
#include <string>
#include <vector>
#include <list>
+#include <ace/INET_Addr.h>
// Searcher for map of structs
template<typename T, class S> struct Finder
@@ -343,6 +344,13 @@ void utf8printf(FILE* out, const char *str, ...);
void vutf8printf(FILE* out, const char *str, va_list* ap);
bool IsIPAddress(char const* ipaddress);
+
+/// Checks if address belongs to the a network with specified submask
+bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask);
+
+/// Transforms ACE_INET_Addr address into string format "dotted_ip:port"
+std::string GetAddressString(ACE_INET_Addr const& addr);
+
uint32 CreatePIDFile(const std::string& filename);
std::string ByteArrayToHexStr(uint8 const* bytes, uint32 length, bool reverse = false);
diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp
index e0f4e7f0de6..359abd39901 100644
--- a/src/server/worldserver/RemoteAccess/RASocket.cpp
+++ b/src/server/worldserver/RemoteAccess/RASocket.cpp
@@ -33,6 +33,7 @@
RASocket::RASocket()
{
_minLevel = uint8(ConfigMgr::GetIntDefault("RA.MinLevel", 3));
+ _commandExecuting = false;
}
RASocket::~RASocket()
@@ -49,16 +50,22 @@ int RASocket::open(void *)
return -1;
}
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr());
return activate();
}
int RASocket::handle_close(ACE_HANDLE, ACE_Reactor_Mask)
{
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Closing connection");
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Closing connection");
peer().close_reader();
wait();
+ // While the above wait() will wait for the ::svc() to finish, it will not wait for the async event
+ // RASocket::commandfinished to be completed. Calling destroy() before the latter function ends
+ // will lead to using a freed pointer -> crash.
+ while (_commandExecuting.value())
+ ACE_OS::sleep(1);
+
destroy();
return 0;
}
@@ -142,7 +149,7 @@ int RASocket::process_command(const std::string& command)
if (command.length() == 0)
return 0;
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Got command: %s", command.c_str());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Received command: %s", command.c_str());
// handle quit, exit and logout commands to terminate connection
if (command == "quit" || command == "exit" || command == "logout") {
@@ -150,6 +157,7 @@ int RASocket::process_command(const std::string& command)
return -1;
}
+ _commandExecuting = true;
CliCommandHolder* cmd = new CliCommandHolder(this, command.c_str(), &RASocket::zprint, &RASocket::commandFinished);
sWorld->QueueCliCommand(cmd);
@@ -184,15 +192,13 @@ int RASocket::check_access_level(const std::string& user)
AccountMgr::normalizeString(safeUser);
-
-
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS);
stmt->setString(0, safeUser);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
{
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str());
return -1;
}
@@ -200,12 +206,12 @@ int RASocket::check_access_level(const std::string& user)
if (fields[1].GetUInt8() < _minLevel)
{
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str());
return -1;
}
else if (fields[2].GetInt32() != -1)
{
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
return -1;
}
@@ -231,7 +237,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass)
if (!result)
{
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str());
return -1;
}
@@ -254,7 +260,7 @@ int RASocket::authenticate()
if (recv_line(pass) == -1)
return -1;
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str());
if (check_access_level(user) == -1)
return -1;
@@ -262,7 +268,7 @@ int RASocket::authenticate()
if (check_password(user, pass) == -1)
return -1;
- sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str());
+ sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str());
return 0;
}
@@ -338,7 +344,12 @@ int RASocket::subnegotiate()
//! Just send back end of subnegotiation packet
uint8 const reply[2] = {0xFF, 0xF0};
+
+#ifdef MSG_NOSIGNAL
+ return int(peer().send(reply, 2, MSG_NOSIGNAL));
+#else
return int(peer().send(reply, 2));
+#endif // MSG_NOSIGNAL
}
int RASocket::svc(void)
@@ -388,7 +399,8 @@ void RASocket::zprint(void* callbackArg, const char * szText)
ACE_Message_Block* mb = new ACE_Message_Block(sz);
mb->copy(szText, sz);
- if (socket->putq(mb, const_cast<ACE_Time_Value*>(&ACE_Time_Value::zero)) == -1)
+ ACE_Time_Value tv = ACE_Time_Value::zero;
+ if (socket->putq(mb, &tv) == -1)
{
sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
mb->release();
@@ -408,10 +420,11 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/)
// the message is 0 size control message to tell that command output is finished
// hence we don't put timeout, because it shouldn't increase queue size and shouldn't block
- if (socket->putq(mb) == -1)
- {
+ if (socket->putq(mb->duplicate()) == -1)
// getting here is bad, command can't be marked as complete
sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
- mb->release();
- }
+
+ mb->release();
+
+ socket->_commandExecuting = false;
}
diff --git a/src/server/worldserver/RemoteAccess/RASocket.h b/src/server/worldserver/RemoteAccess/RASocket.h
index d23d1f0d5fd..e92cb35eaf0 100644
--- a/src/server/worldserver/RemoteAccess/RASocket.h
+++ b/src/server/worldserver/RemoteAccess/RASocket.h
@@ -57,6 +57,7 @@ class RASocket: public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
private:
/// Minimum security level required to connect
uint8 _minLevel;
+ ACE_Atomic_Op<ACE_Thread_Mutex, bool> _commandExecuting;
};
#endif
/// @}
diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp
index 5d578a19124..dd82c6ce0c7 100644
--- a/src/server/worldserver/TCSoap/TCSoap.cpp
+++ b/src/server/worldserver/TCSoap/TCSoap.cpp
@@ -18,6 +18,9 @@
#include "TCSoap.h"
#include "soapH.h"
#include "soapStub.h"
+#include "World.h"
+#include "AccountMgr.h"
+#include "Log.h"
void TCSoapRunnable::run()
{
@@ -78,33 +81,33 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
// security check
if (!soap->userid || !soap->passwd)
{
- sLog->outDebug(LOG_FILTER_SOAP, "Client didn't provide login information");
+ sLog->outInfo(LOG_FILTER_SOAP, "Client didn't provide login information");
return 401;
}
uint32 accountId = AccountMgr::GetId(soap->userid);
if (!accountId)
{
- sLog->outDebug(LOG_FILTER_SOAP, "Client used invalid username '%s'", soap->userid);
+ sLog->outInfo(LOG_FILTER_SOAP, "Client used invalid username '%s'", soap->userid);
return 401;
}
if (!AccountMgr::CheckPassword(accountId, soap->passwd))
{
- sLog->outDebug(LOG_FILTER_SOAP, "Invalid password for account '%s'", soap->userid);
+ sLog->outInfo(LOG_FILTER_SOAP, "Invalid password for account '%s'", soap->userid);
return 401;
}
if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR)
{
- sLog->outDebug(LOG_FILTER_SOAP, "%s's gmlevel is too low", soap->userid);
+ sLog->outInfo(LOG_FILTER_SOAP, "%s's gmlevel is too low", soap->userid);
return 403;
}
if (!command || !*command)
- return soap_sender_fault(soap, "Command mustn't be empty", "The supplied command was an empty string");
+ return soap_sender_fault(soap, "Command can not be empty", "The supplied command was an empty string");
- sLog->outDebug(LOG_FILTER_SOAP, "Got command '%s'", command);
+ sLog->outInfo(LOG_FILTER_SOAP, "Received command '%s'", command);
SOAPCommand connection;
// commands are executed in the world thread. We have to wait for them to be completed
diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h
index ccdc7b1f89f..b786ee94e81 100644
--- a/src/server/worldserver/TCSoap/TCSoap.h
+++ b/src/server/worldserver/TCSoap/TCSoap.h
@@ -18,17 +18,11 @@
#ifndef _TCSOAP_H
#define _TCSOAP_H
-#include "Common.h"
-#include "World.h"
-#include "AccountMgr.h"
-#include "Log.h"
-
-#include "soapH.h"
-#include "soapStub.h"
-#include "stdsoap2.h"
+#include "Define.h"
#include <ace/Semaphore.h>
#include <ace/Task.h>
+#include <Threading.h>
class TCSoapRunnable: public ACE_Based::Runnable
{
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 31d180df751..069c027d139 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -814,18 +814,6 @@ RecruitAFriend.MaxLevel = 60
RecruitAFriend.MaxDifference = 4
#
-# InstantLogout
-# Description: Required security level for instantly logging out everywhere.
-# Does not work while in combat, dueling or falling.
-# Default: 1 - (Enabled, Mods/GMs/Admins)
-# 0 - (Enabled, Everyone)
-# 2 - (Enabled, GMs/Admins)
-# 3 - (Enabled, Admins)
-# 4 - (Disabled)
-
-InstantLogout = 1
-
-#
# DisableWaterBreath
# Description: Required security level for water breathing.
# Default: 4 - (Disabled)
@@ -1066,7 +1054,7 @@ Event.Announce = 0
#
# BeepAtStart
-# Description: Beep when the world server finished starting (Unix/Linux systems).
+# Description: Beep when the world server finished starting.
# Default: 1 - (Enabled)
# 0 - (Disabled)
@@ -1132,6 +1120,14 @@ DBC.EnforceItemAttributes = 1
AccountInstancesPerHour = 5
#
+# RBAC.DefaultGroups
+# Description: Comma separated list of groups to be added to any account
+# Check auth.rbac_groups for correct ids
+# Default: "" (No group)
+
+RBAC.DefaultGroups = ""
+
+#
###################################################################################################
###################################################################################################
@@ -1568,14 +1564,6 @@ ChatLevelReq.Whisper = 1
ChatLevelReq.Say = 1
#
-# AllowPlayerCommands
-# Description: Allow players to use commands.
-# Default: 1 - (Enabled)
-# 0 - (Disabled)
-
-AllowPlayerCommands = 1
-
-#
# PreserveCustomChannels
# Description: Store custom chat channel settings like password, automatic ownership handout
# or ban list in the database. Needs to be enabled to save custom
@@ -2652,6 +2640,14 @@ PlayerDump.DisallowPaths = 1
PlayerDump.DisallowOverwrite = 1
#
+# UI.ShowQuestLevelsInDialogs
+# Description: Show quest levels next to quest titles in UI dialogs
+# Example: [13] Westfall Stew
+# Default: 0 (do not show)
+
+UI.ShowQuestLevelsInDialogs = 0
+
+#
###################################################################################################
###################################################################################################
@@ -2718,7 +2714,7 @@ PlayerDump.DisallowOverwrite = 1
# Maximum value is 4294967295 (4 gb). Leave blank for no limit.
# NOTE: Does not work with dynamic filenames.
# Example: 536870912 (512 mb)
-#
+#
Appender.Console=1,3,0
Appender.Server=2,2,0,Server.log,w
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 49c17913c64..3adccf105de 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -12,4 +12,6 @@ add_subdirectory(map_extractor)
add_subdirectory(vmap4_assembler)
add_subdirectory(vmap4_extractor)
add_subdirectory(mmaps_generator)
-add_subdirectory(mesh_extractor)
+if (WITH_MESHEXTRACTOR)
+ add_subdirectory(mesh_extractor)
+endif()
diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp
index 4a016f267b4..cd85d926125 100644
--- a/src/tools/mmaps_generator/MapBuilder.cpp
+++ b/src/tools/mmaps_generator/MapBuilder.cpp
@@ -957,7 +957,7 @@ namespace MMAP
if (count != 1)
return false;
- if (header.mmapMagic != MMAP_MAGIC || header.dtVersion != DT_NAVMESH_VERSION)
+ if (header.mmapMagic != MMAP_MAGIC || header.dtVersion != uint32(DT_NAVMESH_VERSION))
return false;
if (header.mmapVersion != MMAP_VERSION)
diff --git a/src/tools/mmaps_generator/TerrainBuilder.cpp b/src/tools/mmaps_generator/TerrainBuilder.cpp
index a42cd2b9bc6..3a87da3d4f1 100644
--- a/src/tools/mmaps_generator/TerrainBuilder.cpp
+++ b/src/tools/mmaps_generator/TerrainBuilder.cpp
@@ -674,14 +674,14 @@ namespace MMAP
// transform data
float scale = instance.iScale;
G3D::Matrix3 rotation = G3D::Matrix3::fromEulerAnglesXYZ(G3D::pi()*instance.iRot.z/-180.f, G3D::pi()*instance.iRot.x/-180.f, G3D::pi()*instance.iRot.y/-180.f);
- Vector3 position = instance.iPos;
+ G3D::Vector3 position = instance.iPos;
position.x -= 32*GRID_SIZE;
position.y -= 32*GRID_SIZE;
for (std::vector<GroupModel>::iterator it = groupModels.begin(); it != groupModels.end(); ++it)
{
- std::vector<Vector3> tempVertices;
- std::vector<Vector3> transformedVertices;
+ std::vector<G3D::Vector3> tempVertices;
+ std::vector<G3D::Vector3> transformedVertices;
std::vector<MeshTriangle> tempTriangles;
WmoLiquid* liquid = NULL;
@@ -698,10 +698,10 @@ namespace MMAP
// now handle liquid data
if (liquid)
{
- std::vector<Vector3> liqVerts;
+ std::vector<G3D::Vector3> liqVerts;
std::vector<int> liqTris;
uint32 tilesX, tilesY, vertsX, vertsY;
- Vector3 corner;
+ G3D::Vector3 corner;
liquid->getPosInfo(tilesX, tilesY, corner);
vertsX = tilesX + 1;
vertsY = tilesY + 1;
@@ -730,11 +730,11 @@ namespace MMAP
// tile = x*tilesY+y
// flag = y*tilesY+x
- Vector3 vert;
+ G3D::Vector3 vert;
for (uint32 x = 0; x < vertsX; ++x)
for (uint32 y = 0; y < vertsY; ++y)
{
- vert = Vector3(corner.x + x * GRID_PART_SIZE, corner.y + y * GRID_PART_SIZE, data[y*vertsX + x]);
+ vert = G3D::Vector3(corner.x + x * GRID_PART_SIZE, corner.y + y * GRID_PART_SIZE, data[y*vertsX + x]);
vert = vert * rotation * scale + position;
vert.x *= -1.f;
vert.y *= -1.f;
@@ -785,12 +785,12 @@ namespace MMAP
}
/**************************************************************************/
- void TerrainBuilder::transform(std::vector<Vector3> &source, std::vector<Vector3> &transformedVertices, float scale, G3D::Matrix3 &rotation, Vector3 &position)
+ void TerrainBuilder::transform(std::vector<G3D::Vector3> &source, std::vector<G3D::Vector3> &transformedVertices, float scale, G3D::Matrix3 &rotation, G3D::Vector3 &position)
{
- for (std::vector<Vector3>::iterator it = source.begin(); it != source.end(); ++it)
+ for (std::vector<G3D::Vector3>::iterator it = source.begin(); it != source.end(); ++it)
{
// apply tranform, then mirror along the horizontal axes
- Vector3 v((*it) * rotation * scale + position);
+ G3D::Vector3 v((*it) * rotation * scale + position);
v.x *= -1.f;
v.y *= -1.f;
transformedVertices.push_back(v);
@@ -798,9 +798,9 @@ namespace MMAP
}
/**************************************************************************/
- void TerrainBuilder::copyVertices(std::vector<Vector3> &source, G3D::Array<float> &dest)
+ void TerrainBuilder::copyVertices(std::vector<G3D::Vector3> &source, G3D::Array<float> &dest)
{
- for (std::vector<Vector3>::iterator it = source.begin(); it != source.end(); ++it)
+ for (std::vector<G3D::Vector3>::iterator it = source.begin(); it != source.end(); ++it)
{
dest.push_back((*it).y);
dest.push_back((*it).z);
diff --git a/src/tools/mmaps_generator/VMapExtensions.cpp b/src/tools/mmaps_generator/VMapExtensions.cpp
index 972f222bba6..08929e5259d 100644
--- a/src/tools/mmaps_generator/VMapExtensions.cpp
+++ b/src/tools/mmaps_generator/VMapExtensions.cpp
@@ -47,7 +47,7 @@ namespace VMAP
}
// declared in src/shared/vmap/WorldModel.h
- void GroupModel::getMeshData(std::vector<Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid)
+ void GroupModel::getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid)
{
vertices = this->vertices;
triangles = this->triangles;
@@ -61,7 +61,7 @@ namespace VMAP
}
// declared in src/shared/vmap/WorldModel.h
- void WmoLiquid::getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const
+ void WmoLiquid::getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const
{
tilesX = iTilesX;
tilesY = iTilesY;